Powershell and Task Scheduler

Hi guys

Got a minor issue here that is driving me nuts. I have made a script that crawls a lot of XML config files over a UNC path. It works perfectly when running normally, but setting it up as a Task it fails at accessing the UNC share… Any one got a good hint on what to do next. Below is just a test script i wrote to see it happen.

#Creating variables and filling in default data for file crawl
$StartPath="\\ServerName\Customers\" #location of starting directory
#Done creating variables and arrays

$Script:Customers = (Get-ChildItem $StartPath -Directory)

My script is split up into functions. I’m using the $Customers later in the script, so that is why I load it as $Script:Customers so I can use the result in another function.

I have tried running the task as SYSTEM, admin and admin with highest privileges.



Running test and task with same account or rights?


Hi Jake

I login to the server with my normal user, but start Powershell ISE as administrator and it works just fine.
I’ll try tomorrow to login in with local admin and test, just be make sure.

Running as local admin could be the issue - that account won’t have rights to a share on another machine

ah yes that seemed to do the trick. Used my own user in the admin group and can now run it with highest privileges.

thanks :slight_smile: