Hello!
I need to run a pre-repair script to enable the Windows Update service before the patching process begins. I have a VB script that sets the service to automatic and works correctly, but the action reports a failure. Below is the script I am using. Does anyone have any idea what I need to add to the script so the action wont fail?
strComputer = .
objServiceName = "wuauserv"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CimV2")
Set colListOfServices = objWMIService.ExecQuery ("Select * From Win32_Service Where Name ='" & objServiceName & "'")
For Each objService in colListOfServices
objService.ChangeStartMode("Automatic")
Wscript.Sleep 5000
errReturnCode = objService.StartService()
Next
ReportRepairResult true, "Windows Update Enabled"