Here's a screenshot from scheduled task action settings
-
Please make sure you include all the details to reproduce the issue. Screenshot doesn't contain too much useful information as both `Program` and `Arguments` are cropped. – Robert Dyjas Jun 04 '20 at 07:08
-
Check this link https://stackoverflow.com/questions/2035193/how-to-run-a-powershell-script – armagedescu Jun 05 '20 at 14:56
2 Answers
First of all make sure the path used for powershell is correct (best option in my opinion is to click Browse... and select the program with the dialog window instead of manually inserting the full path, if that's what you did).
In second place, change Add arguments (optional): to -File "D:\TM1 Model\Test GIIS\...\yourfilename.ps1"
, please note you should use double quote since the full path contains spaces; again, make sure the full file path is typed correctly.

- 548
- 6
- 17
-
1Hi Giacomo, thank you for your response. It is resolved. I was missing double quotes. – Avinash Jha Jul 02 '20 at 12:31
There should be no need to insert the full path in the in the Program/script box. Most people don't even know where it is.
For all the PowerShell scripts that I run on servers I only type powershll.exe and it works.
I agree with Giacomo (Calvin?), the value in the Add Arguements box needs to be in quotes if you have spaces in the folder or file name. ie -File "C:\Batch Files\checkdisk.bat"
The -File argument is telling PowerShell the file you want powershell.exe to run.

- 11
- 3