I'm having problems running a script through the schedule task. It runs fine when I run it manually through PS or if I start the Task manually from the Task Scheduler window. However, if I logoff the machine, the script runs but it doesn't seem to evaluate a "if" logic conditional properly.
Specifically i'm evaluating the following:
If (test-path \\uncname\folder\*zip)
{
}
else
{
}
When I run it unattended through the Scheduled Tasks, it always evaluates false and executes whatever is in the else field.
I've checked the Task Scheduler account that is running the script. I'm using the same account either running it manually or unattended.
Any ideas on how to troubleshoot?