Link to home
Start Free TrialLog in
Avatar of Phiwi Moyo
Phiwi MoyoFlag for Germany

asked on

How do I schedule a powershell script?

I have this simple script to stop and start an application at 12:00 AM daily.

I want to schedule it, but it will not run all the commands on my script.

It kills the application, but never starts it again.

taskkill /F /IM A5ApplicationServer.exe; 
Start-Sleep -s 10;
Start-Process C:\"Program Files\a5V11 ApplicationServer"\A5ApplicationServer.exe;

Open in new window


I am open to a different route in order to achieve this, even if it's via dos or vbscript.

Thank you.
Avatar of Kash
Kash
Flag of United Kingdom of Great Britain and Northern Ireland image

why not have 2 separate scripts one to shut down and one to start and then reference them in another so that they work together.

Also, have them set in task scheduler. Just my 2 pence
Avatar of Montoya
Montoya

I use AutoIt to script just about everything.
https://www.autoitscript.com/site/autoit/

Free and awesome.
Have you tried to increase de Start-Sleep parameter? Maybe to 30 seconds or so?
And I'm assuming that you are using Windows Schedule Task for schedule the script.
ASKER CERTIFIED SOLUTION
Avatar of Phiwi Moyo
Phiwi Moyo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phiwi Moyo

ASKER

Solved it myself.