JSI Tip 10611. How can I enable and start a service on all the computers in my domain?

Jerold Schulman

June 26, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

Using Available.bat, I have scripted Start_Service.bat to configure and start the specified service on all available computers in the domain you are logged onto.

The syntax for using Start_Service.bat is:

Start_Service Service_Short_Name

Where Service_Short_Name is the short name of the service you wish to start.

NOTE: See How do I find the short name of a service?

NOTE: You must run Start_Service.bat from Windows Server 2003, or Windows XP, or a later operating system.

NOTE: Start_Service.bat will log the computer names that were not available in Start_Service.log in the current folder.

Start_Service.bat contains:

@echo offIf {%1}=={} @echo Syntax: Start_Service Service_Short_Name&goto :EOFsetlocalset SVC=%1set WRK=%SVC:"=%set OK=Ncall :QREG>nul 2>&1if "%OK%" EQU "N" @echo Syntax: Start_Service Service_Short_Name - %SVC% does NOT exist.&endlocal&goto :EOFif exist Start_Service.log del /q Start_Service.logfor /f "Tokens=1,2" %%c in ('Available') do ( if "%%d" EQU "Y" call :strtsvc "\%%c">nul 2>&1 if "%%d" EQU "N" @echo %%c>>Start_Service.log)endlocalgoto :EOF:QREGfor /f "Tokens=*" %%i in ('REG QUERY "HKLMSystemCurrentControlSetServices%WRK%" /V Start') do ( set OK=Y)goto :EOF:strtsvcset OK=Nfor /f "Tokens=*" %%s in ('sc %1 query %SVC%^|find "4  RUNNING"') do ( set OK=Y)if "%OK%" EQU "Y" goto :EOFsc %1 config %SVC% start= autosc %1 start %SVC%



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like