Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
- Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
- set objShell = CreateObject("Wscript.shell")
- strServiceName = "wuauserv"
- Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
- For Each objService in colListOfServices
- if objService.state = "Running" then
- objService.StopService()
- objService.ChangeStartMode("Disabled")
- else
- objService.ChangeStartMode("Manual")
- objService.StartService()
- objshell.run "wuauclt /detectnow"
- wscript.sleep 3600000
- if objSysInfo.rebootrequired then
- objshell.run "shutdown /r /t 300"
- end if
- end if
- Next
Advertisement
Add Comment
Please, Sign In to add comment