How To Set Multiple Services On Multiple Remote Computers

by [Published on 15 June 2010 / Last Updated on 30 July 2009]

This article explains setting up multiple services on remote computers.

This article can be useful for users who want to set multiple services on remote computers. The following steps can be performed to accomplish this:


1. Create a text file: Comps.TXT

2. Put all the computer names in it.

3. Create another text file and put all the services you want to start: Services.TXT

4. Create a batch file: SetServices.CMD and put the following lines in it:

  • @ Echo OFF 
  • setlocal enabledelayedexpansion
  • FOR /F "Tokens=*" %%L IN (Comps.TXT) DO (
  • SET CompName=%%L
  • FOR /F "Tokens=*" %%L IN (Services.TXT) DO SC \\!CompName! Start %%L auto
  • )
  • )

5. Finally, run the SetServices.CMD from a command window.

The above script start the services mentioned in the Services.TXT file on computers mentioned in the Comps.TXT file.


See Also

The Author — Nirmal Sharma

Nirmal Sharma avatar

Nirmal Sharma is a MCSEx3, MCITP and was awarded the Microsoft MVP award in Directory Services and Windows Networking. He specializes in Microsoft Azure, Office 365, Directory Services, Failover Clusters, Hyper-V, PowerShell Scripting and System Center products. Nirmal has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites and contributing to PowerShell-based Dynamic Packs for www.ITDynamicPacks.Net solutions.

Featured Links