Link to home
Start Free TrialLog in
Avatar of Rad1
Rad1

asked on

How to run Power Shell script on a web server (Windows 2008 R2)

Hello,

I have a Power Shell Script that I need to run every 9 minutes.  
If I put it on a file share, how can I get the script to run every 9 minutes without using Windows Task Scheduler.
Is there a way to make it run by itself?

Windows Server 2008 R2
Avatar of Cliff Galiher
Cliff Galiher
Flag of United States of America image

Why can't you use task scheduler?  That's its job, just like cron on Unix. It is pretty core to the OS.
Avatar of Rad1
Rad1

ASKER

Because I need it now.  At work will take me 3 weeks to get the task scheduler to be implemented.
Well firing off a script "now" is possible if WinRM is enabled. But the "repeat every 9 minutes" will require task scheduler. That's what it is there for. The only other way would be to deploy software that does what task scheduler does, and then you are in the same boat of not being able to do that "now" as it isn't core to the OS...it'd be a full software deployment.
Avatar of Rad1

ASKER

What about creating a clock script and in the script, set a function to run every 9 minutes to run the Power Shell script.  Would that work?
Not well. Scripts don't handle waits well. They basically brute force it by either forcibly throwing idle commands at a processor, which will kill performance of other threads, or by going to sleep, which isn't exact as to when the processor will return to check on the thread. The execute won't necessarily at 9 minutes, but sometime thereafter. If it were that easy, there'd be no need for a task scheduler.
ASKER CERTIFIED SOLUTION
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada 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 Rad1

ASKER

Excellent!!!