Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Need to create a batch file for restarting some services remotely and restarting iis remotely in Admin mode.

Help would be appreciated

Thanks krish

share|improve this question
    
Can you give more info - Like which service you want to start? How important is error checking? –  RobW Feb 12 '10 at 15:59
add comment

3 Answers 3

SC and net start net stop are the way to go.

MS KB link for SC.

Technet on net commands.

there's also iisrest which is a command line utility specifically for IIS.

share|improve this answer
add comment

Why not just use SC? http://ss64.com/nt/sc.html

share|improve this answer
    
I want batch file commands so that i can execute the batch file. –  krish Feb 10 '10 at 9:38
    
So... put it in a batch file. A batch file is merely a series of otherwise single command lines. If you read the link I posted, you'd find examples. Examples like: sc \\server1 start schedule sc \\server4 start messenger sc \\server1 stop schedule sc \\server4 stop messenger sc \\webserver stop w3svc sc \\webserver start w3svc –  Multiverse IT Feb 10 '10 at 12:03
add comment

+1 for SC

To elevate past UAC (if that is what you mean by run with admin privileges) you can use elevate.cmd - http://technet.microsoft.com/en-us/magazine/2007.06.utilityspotlight.aspx?pr=blog

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.