This topic contains 4 replies, has 3 voices, and was last updated by
January 31, 2017 at 6:58 pm #63123
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.
January 31, 2017 at 7:06 pm #63126ParticipantTopics: 0Replies: 61Points: -11Rank: Member
Running test and task with same account or rights?
January 31, 2017 at 7:10 pm #63129
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.
January 31, 2017 at 7:54 pm #63130ParticipantTopics: 0Replies: 669Points: 0Rank: Member
Running as local admin could be the issue – that account won't have rights to a share on another machine
February 1, 2017 at 8:16 am #63189
ah yes that seemed to do the trick. Used my own user in the admin group and can now run it with highest privileges.
The topic ‘Powershell and Task Scheduler’ is closed to new replies.