Last active
January 4, 2016 13:53
-
-
Save 330k/7d74e3760dfda9fdb844 to your computer and use it in GitHub Desktop.
Disable Windows Update (e.g. GWX.exe) without WSUS Servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************************** | |
Disable Specified Windows Updates (KB******) without WSUS | |
Copyright (c) 2015 Kei Misawa | |
This software is released under the MIT License. | |
http://opensource.org/licenses/mit-license.php | |
**********************************************************************/ | |
try{ | |
// KB numbers you want to disable | |
var disabledKBs = [ | |
3035583 | |
]; | |
var disabledKBregexp = new RegExp('(' + disabledKBs.join(')|(') + ')'); | |
var updateSession, updateSearcher, searchResult, update; | |
// Make invisible if not installed | |
updateSession = new ActiveXObject("Microsoft.Update.Session"); | |
updateSession.ClientApplicationID = "info.330k.disable_wupdate"; | |
updateSearcher = updateSession.CreateUpdateSearcher(); | |
searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0"); | |
for(var i = 0; i < searchResult.Updates.Count; i++){ | |
update = searchResult.Updates.Item(i); | |
for(var j = 0; j < update.KBArticleIDs.Count; j++){ | |
if(disabledKBregexp.test(update.KBArticleIDs.Item(j))){ | |
update.IsHidden = true; | |
break; | |
} | |
} | |
} | |
catch(e){ | |
//for debug | |
//WScript.Echo(e.message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment