Scheduled task

PowerShell script exchange

Scheduled task

Veeam Logoby ftbug » Wed Sep 28, 2016 3:19 pm

Hi, i have been running some powershell scripts to disable a group of jobs, which are running fine when right clicking the .ps1 file and running with powershell, however, when i choose to open .ps1 files through powershell automatically, the script seems to fail?

i would like to run this script as a scheduled task, but when the option is selected to open the file with powershell it fails, and when the option isnt selected, the scheduled task just opens the notepad form of the .ps1 file
ftbug
Enthusiast
 
Posts: 59
Liked: 2 times
Joined: Wed Nov 18, 2015 10:12 am
Full Name: Freddie

Re: Scheduled task

Veeam Logoby PTide » Wed Sep 28, 2016 3:58 pm

Hi,

when i choose to open .ps1 files through powershell automatically, the script seems to fail?
Do you mean that the script fails if you specify it within the job?

i would like to run this script as a scheduled task
Do you want to run it with windows Task Scheduler or with Veeam? Please elaborate.

Also kindly provide the body of the script and the error message that you get.

Thanks
PTide
Veeam Software
 
Posts: 3019
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Scheduled task

Veeam Logoby tdewin » Thu Sep 29, 2016 9:28 am

you might want to run the script not directly but via powershell.exe and then -c c:\scr\script.ps1 as arguments so that the whole task commandline would be powershell -c c:\scr\script.ps1
tdewin
Veeam Software
 
Posts: 1043
Liked: 361 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests