<\/use><\/svg><\/div><\/a><\/div><\/p>","upvoteCount":0,"datePublished":"2014-10-03T13:06:52.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/5","author":{"@type":"Person","name":"ronniesimmons5365","url":"https://community.spiceworks.com/u/ronniesimmons5365"}},{"@type":"Answer","text":"Does the account running the scheduled task have access? You aren’t showing those settings.<\/p>","upvoteCount":0,"datePublished":"2014-10-03T13:15:33.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/6","author":{"@type":"Person","name":"Little-Green-Man","url":"https://community.spiceworks.com/u/Little-Green-Man"}},{"@type":"Answer","text":"
Yes, I’m logged in as the user the scheduled task is set to run under and it runs the script when just browsing and running it from the folder.<\/p>","upvoteCount":0,"datePublished":"2014-10-03T13:29:04.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/7","author":{"@type":"Person","name":"ronniesimmons5365","url":"https://community.spiceworks.com/u/ronniesimmons5365"}},{"@type":"Answer","text":"
I’ve just tried to simplify things and just create a task to get the powershell and the powershell ISE to start and nothing when I try to run it. So it seems that my problem is that powershell is not starting at all? All I did was set the start program as:<\/p>\n
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell_ise.exe<\/p>\n
or<\/p>\n
C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe<\/p>\n
It says the status is running but the ISE does not pop up.<\/p>","upvoteCount":0,"datePublished":"2014-10-03T13:39:34.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/8","author":{"@type":"Person","name":"ronniesimmons5365","url":"https://community.spiceworks.com/u/ronniesimmons5365"}},{"@type":"Answer","text":"\n\n
<\/div>\n
NinjaMonk2034:<\/div>\n
\nIt says the status is running but the ISE does not pop up.<\/p>\n<\/blockquote>\n<\/aside>\n
Do you have the task set as Interactive?<\/p>\n
I prefer scheduling tasks via PowerShell<\/p>\n
$user = \"domain\\user\"\n$pass = \"password\"\n$task = \"Example Scheduled Script\"\n$time = \"04:04:00\"\n$path = \"c:\\cron\\script.ps1\"\nschtasks /create /tn $task /st $time /sc daily /ru $user /rp $pass /TR \"C:\\WINDOWS\\system32\\windowspowershell\\v1.0\\powershell.exe $path\"\n<\/code><\/pre>","upvoteCount":1,"datePublished":"2014-10-03T13:45:20.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/9","author":{"@type":"Person","name":"buckykoehler6644","url":"https://community.spiceworks.com/u/buckykoehler6644"}},{"@type":"Answer","text":"Wouldn’t run directly as a powershell script in the task manager so I set it to run as a batch file with the powershell commands inside and it worked go figure?<\/p>","upvoteCount":0,"datePublished":"2014-11-05T17:50:59.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/10","author":{"@type":"Person","name":"ronniesimmons5365","url":"https://community.spiceworks.com/u/ronniesimmons5365"}},{"@type":"Answer","text":"
Did you try instead putting the execution policy bypass into the script? The start program “PowerShell.exe” should have no switches after it, maybe that’s the hangup?<\/p>","upvoteCount":0,"datePublished":"2014-11-05T18:01:12.000Z","url":"https://community.spiceworks.com/t/scheduled-powershell-task/344367/11","author":{"@type":"Person","name":"Little-Green-Man","url":"https://community.spiceworks.com/u/Little-Green-Man"}}]}}
I am having a problem running a scheduled powershell script from a windows 8 desktop that’s moving files from one folder to another. I can run it if I right click on the file and select “run with powershell” but when I set it as a scheduled task I get nothing with either the trigger or forcing it to run? The arguments are:
Action:
Start a program
Program/Script:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Add arguments :
-ExecutionPolicy Unrestricted -Command { & ‘C:\BemisScripts\bemisreports.ps1’}
5 Spice ups
ealy
(Mealy58)
October 3, 2014, 12:13pm
2
with out seeing the script my guess is you need to add.
cd /
to the script so it doesn’t run the script in your folder.
martin9700
(Martin9700)
October 3, 2014, 12:23pm
3
5 Spice ups
I believe this will work if you just use Powershell.exe and not the full path. That’s how I have mine configured and they all work.
The path will auto-complete, but for your additional args, you need to ensure that whatever account you are using for the scheduled task has access to the script you are trying to run AND has the proper access to change the execution policy.
2 Spice ups
Not getting anything with these settings also, if it will help to add the script code which is very basic let me know. Again if I run right click it and run it from the directory it works fine.
Thanks
Does the account running the scheduled task have access? You aren’t showing those settings.
Yes, I’m logged in as the user the scheduled task is set to run under and it runs the script when just browsing and running it from the folder.
I’ve just tried to simplify things and just create a task to get the powershell and the powershell ISE to start and nothing when I try to run it. So it seems that my problem is that powershell is not starting at all? All I did was set the start program as:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe
or
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
It says the status is running but the ISE does not pop up.
Do you have the task set as Interactive?
I prefer scheduling tasks via PowerShell
$user = "domain\user"
$pass = "password"
$task = "Example Scheduled Script"
$time = "04:04:00"
$path = "c:\cron\script.ps1"
schtasks /create /tn $task /st $time /sc daily /ru $user /rp $pass /TR "C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe $path"
1 Spice up
Wouldn’t run directly as a powershell script in the task manager so I set it to run as a batch file with the powershell commands inside and it worked go figure?
Did you try instead putting the execution policy bypass into the script? The start program “PowerShell.exe” should have no switches after it, maybe that’s the hangup?