Setting The Automatic Updates Service Start Mode To Automatic For ITMU Use

 

This Vbs script will prompt you for a remote or local machine name and set the Automatic Updates service start mode to Automatic and start the service if it is not running for ITMU use.

 

Vbs Script:

 

strComputer = InputBox("Enter Machine Name")

srtService = "Automatic Updates"

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\Cimv2")

 

Set colItems = objWMIService.ExecQuery _

("Select * from Win32_Service Where DisplayName ='" & srtService & "'")

 

For Each objItem in colItems

If objItem.State = "Running" Then

objItem.StopService()

End If

errRetCode = objItem.ChangeStartMode("Automatic") 

objItem.StartService()

Next

 

MsgBox "The " & srtService & " on " & UCase(strComputer) & " Has Been Set To Automatic"

 

Published Sunday, June 24, 2007 8:22 AM by dhite
Filed under:

Comments

No Comments