none
In windows server 2008 R2 Schedule a Powershell script RRS feed

  • Question

  • I wrote the following script

    function get-test

    {

        if (test-path c:\windows\temp\fileText.txt)

        {

            "File exist in directory " > c:\windows\temp\testLog.txt

             "Process time : $(get-time) >> c:\windows\temp\testLog.txt

         }

    }

    When I create the schedule I use the following options in the arguments

    -executionPolicy unrestricted -Noninteractive -NoProfile -Command & {c:\windows\temp\get-test.ps1}

    When I force the program thru the schedule it runs to completion without error but it nevers creates the log file.

    What I am doing wrong?


    michael john ocasio

    Tuesday, May 5, 2015 7:19 PM

Answers

All replies