Source: Top Shelf It Solutions Blog

Top Shelf It Solutions Blog Using built-in Windows sc.exe command to remotely reboot SQL Server and IIS

Windows has a built-in sc.exe tool which allows you to control local and remote services. When you need to reboot remote services you normally initiate Remote Desktop connection to the server and reboot desired services from there. It is a lot more convenient to write a batch file to do the desired job and store it on your local system. Here are the commands you would use in RebootRemoteIIS.bat file:net use \\server-ip password /USER:username sc \\server-ip stop w3svc sc \\server-ip start w3svcUsing the same procedure, it is easy to write a batch file to reboot remote SQL. Here are the contents of RebootRemoteSQL.bat file:net use \\server-ip password /USER:username sc \\server-ip stop sqlserveragent sc \\server-ip stop mssqlserver sc \\server-ip start mssqlserver sc \\server-ip start sqlserveragentYou can use sc.exe command to perform just about any administrative tasks on the servers. See http://technet.microsoft.com/en-us/library/cc754599%28v=ws.10%29.aspx for full command reference.

Read full article »
Est. Annual Revenue
$100K-5.0M
Est. Employees
25-100
CEO Avatar

CEO

Update CEO

CEO Approval Rating

- -/100