Script to fix error with start up of AU and BITS (EventID 7023 and 7024)
This script detects and tries to fix the error related to start up of Automatic Updates and BITS services on network computers. Such error is related to security identifier (EventID 7023 and EventID 7024). This problem is usually observed on network computers after applying changes to group policies. In such cases the script will reset a security identifier as per Microsoft KB 555336 (http://support.microsoft.com/kb/555336) and start Automatic Updates and BITS. Can be usefull for networks where Windows Server Update Services 3.0 (WSUS) is used.
Script is taken from: http://forum.vingrad.ru/forum/topic-154708/view-all.html
' This script detects and tries to fix the error related to start up of Automatic Updates and BITS services
' on network computers. Such error is related to security identifier (EventID 7023 and EventID 7024).
' This problem is usually observed on network computers after applying changes to group policies.
' In such cases the script will reset a security identifier as per Microsoft KB 555336
' http://support.microsoft.com/kb/555336 and start Automatic Updates and BITS.
' Can be usefull for networks where Windows Server Update Services 3.0 (WSUS) is used.
' Script source: http://forum.vingrad.ru/forum/topic-154708/view-all.html
' Initialize variables and WMI-moniker
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
' Select Automatic Updates and BITS services from the list of services
Set colListOfServices = objWMIService.ExecQuery _
("Select * from Win32_Service Where Name = 'BITS' or Name = 'wuauserv'")
' For each of selected services:
For Each objService in colListOfServices
isStarted = 0
' Check its status. If stopped then
If objService.State = "Stopped" Then
' Try to start it.
WScript.Echo ("Service " & objService.Name & " Stopped")
isStarted = objService.StartService()
' If when starting we get the same problem try to fix it
' (fix is provided by the Repair function)
If objService.ExitCode <> 0 Then
WScript.Echo("WARNING!!! Error occured, when try to started...")
WScript.Echo ("Try to repair..." & objService.Name)
intCode = Repair(strComputer)
If intCode = 0 Then
WScript.Echo("Done...")
objService.StartService
Else WScript.Echo("Failed To Repair")
End If
Else If objService.ExitCode = 0 Then WScript.Echo ("Successfully stated...")
End If
End If
Next
Function Repair(strComputer)
strCommandLine = "sc sdset " & objService.Name & " " & Chr(34) & "D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" & Chr(34)
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
' Obtain the definition of the class.
Set objShare = objWMIService.Get("Win32_Process")
' Obtain an InParameters object specific
' to the method.
Set objInParam = objShare.Methods_("Create"). _
inParameters.SpawnInstance_()
' Add the input parameters.
objInParam.Properties_.Item("CommandLine") = strCommandLine
' Execute the method and obtain the return status.
' The OutParameters object in objOutParams
' is created by the provider.
Set objOutParams = objWMIService.ExecMethod("Win32_Process", "Create", objInParam)
' List OutParams
WScript.Echo "Out Parameters: "
WScript.echo "ProcessId: " & objOutParams.ProcessId
Repair = objOutParams.ReturnValue
End Function
