Skip to content

Instantly share code, notes, and snippets.

@330k
Last active January 4, 2016 13:53
Show Gist options
  • Save 330k/7d74e3760dfda9fdb844 to your computer and use it in GitHub Desktop.
Save 330k/7d74e3760dfda9fdb844 to your computer and use it in GitHub Desktop.
Disable Windows Update (e.g. GWX.exe) without WSUS Servers
/**********************************************************************
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