Script to restart service

Cobra25 used Ask the Experts™
Hi Guys,

I need a script that will restart a specific service every 12 hours for server 2008 r2.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
sc stop "service"
sc start "service"

as a batch file and then put it in task scheduler to run?

Will SzymkowskiSenior Solution Architect
Most Valuable Expert 2015
Top Expert 2015

You can do this vary easily with powershell...
See the below example...

restart-service -Name BITS

Open in new window

Save the script as Restart.ps1

Launch a Powershell Script from Task Scheduler


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial