0

The following script checks for network share availability:

while($true)
{
    $i++
    test-path Z: |Foreach{"{0} - {1}" -f (Get-Date),$_} | Out-File "F:\script\path.log" -Append
    Start-Sleep -s 5
}

OUTPUT:

True

Executing from task scheduler as same user returns false. What can be wrong?

0

The problem is, the Task Scheduler doesn't know the environment variablessuch as "Z:". Testing with the Fully Qualified network share name make it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.