I have a file server in which I'm trying to run a powershell script as a scheduled task each day. It does not appear to be working.
I can manually run the script using the syntax ./scriptname.ps1, however I can't get it to run using something like:
c:\windows\system32\windowspowershell\v1.0\powershell.exe d:\userdata\redirect.ps1
I've also tried this:
powershell -file "D:\userdata\redirect.ps1"
Neither of these work (just trying from the Run box or from a command prompt). If I go into powershell and run
./redirect.ps1the script runs fine and does its thing.
In case anyone is wondering, this script goes through our userdata folders and denies Read access for admins to the desktop.ini file it puts in there so everyone's folder doesn't just show up as "Documents."