We help IT Professionals succeed at work.

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

208 Views
Last Modified: 2014-12-17
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
Comment
Watch Question

CERTIFIED EXPERT
Distinguished Expert 2018

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

Author

Commented:
Because I need it now.  At work will take me 3 weeks to get the task scheduler to be implemented.
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
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.

Author

Commented:
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?
CERTIFIED EXPERT
Distinguished Expert 2018

Commented:
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.
Simple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Excellent!!!
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.