Harrod200

Win10 Update Control v1.0

Oct 14th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set objSysInfo = CreateObject("Microsoft.Update.SystemInfo")
  2. Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
  3. set objShell = CreateObject("Wscript.shell")
  4.  
  5. strServiceName = "wuauserv"
  6. Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")
  7.  
  8. For Each objService in colListOfServices
  9.     if objService.state = "Running" then
  10.         objService.StopService()
  11.         objService.ChangeStartMode("Disabled")
  12.     else
  13.         objService.ChangeStartMode("Manual")
  14.         objService.StartService()
  15.         objshell.run "wuauclt /detectnow"
  16.         wscript.sleep 3600000
  17.  
  18.         if objSysInfo.rebootrequired then
  19.             objshell.run "shutdown /r /t 300"
  20.         end if
  21.     end if
  22. Next
Advertisement
Add Comment
Please, Sign In to add comment