Skip to content

Instantly share code, notes, and snippets.

@empjustine
Forked from oflow/window_update_toggle.vbs
Created May 20, 2018 03:04
Show Gist options
  • Save empjustine/3239c78a2f261fd7cd93a02546d7eacf to your computer and use it in GitHub Desktop.
Save empjustine/3239c78a2f261fd7cd93a02546d7eacf to your computer and use it in GitHub Desktop.
俺のタイミングで更新させろ!それ以外は何もするな!何もするな!!
sc config wuauserv start= disabled
net stop wuauserv & REM Windows Update
net stop appidsvc
net stop BITS & REM Background Intelligent Transfer Service
net stop UsoSvc & REM Update Orchestrator Service for Windows Update
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