Skip to content

Instantly share code, notes, and snippets.

@oflow
Created May 9, 2017 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save oflow/57f3556b5f2698e783c2f548a1314276 to your computer and use it in GitHub Desktop.
Save oflow/57f3556b5f2698e783c2f548a1314276 to your computer and use it in GitHub Desktop.
俺のタイミングで更新させろ!それ以外は何もするな!何もするな!!
Option Explicit
Dim wsh, svList, svInfo
Dim scPath, query, scMode
scPath = "%WINDIR%\System32\sc.exe"
query = "SELECT * FROM Win32_Service WHERE Name='wuauserv'"
Set svList = GetObject("winmgmts:").ExecQuery(query)
For Each svInfo In svList
scMode = svInfo.StartMode
Next
Set wsh = WScript.CreateObject("WScript.Shell")
wsh.Run scPath & " stop wuauserv", 0
wsh.Run scPath & " stop UsoSvc", 0
If scMode <> "Disabled" Then
wsh.Run scPath & " config wuauserv start=disabled", 0
wsh.Run scPath & " config UsoSvc start=disabled", 0
Else
wsh.Run scPath & " config wuauserv start=demand", 0
wsh.Run scPath & " config UsoSvc start=demand", 0
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment