biatche Posted November 3, 2011 Share Posted November 3, 2011 var updateSession = WScript.CreateObject("Microsoft.Update.Session");var updateSearcher = updateSession.CreateUpdateSearcher();updateSearcher.Online = false;// this part must be changed? this is the language pack section. I want to search the entire database that isn't installed and filter by KB###### rather than category.var searchResult = updateSearcher.Search("CategoryIDs Contains 'cd5ffd1e-e932-4e3a-bf74-18bf0b1bbd83' And IsInstalled=0");for(var i=0; i<searchResult.Updates.Count; i++){ var update = searchResult.Updates.Item(i); WScript.echo("Hiding:" + update.Title); update.IsHidden = true;}I can't work out how to modify this script so that it will hide certain specific updates filtered by KBtitlesuch as KB2483139 KB915597 KB971033 KB890830actually just these 4.Thanks Link to comment Share on other sites More sharing options...
ndog Posted December 8, 2011 Share Posted December 8, 2011 This is vbs which works for me. If you can convert to js then share with the rest of the world that would be niceFunction WuaVersion 'get current WUA version Dim oAgentInfo, ProductVersion On Error Resume Next Err.Clear Set oAgentInfo = CreateObject("Microsoft.Update.AgentInfo") If ErrNum = 0 Then WuaVersion = oAgentInfo.GetInfo("ProductVersionString") Else Wscript.Echo "Error getting WUA version." WuaVersion = 0 'calling code can interpret 0 as an error. End If On Error Goto 0End Function msgbox(WuaVersion)if WuaVersion <> "0" then Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager") ServiceManager.ClientApplicationID = "My App" 'add the Microsoft Update Service, GUID Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")end if'ServerSelection valuesssDefault = 0ssManagedServer = 1ssWindowsUpdate = 2ssOthers = 3'InStr valuesintSearchStartChar = 1dim strTitleSet updateSession = CreateObject("Microsoft.Update.Session")Set updateSearcher = updateSession.CreateupdateSearcher()updateSearcher.ServerSelection = ssWindowsUpdateSet searchResult = updateSearcher.Search("IsInstalled=0 and Type='Software'")For I = 0 To searchResult.Updates.Count-1 Set update = searchResult.Updates.Item(I) strTitle = update.Title if InStr(intSearchStartChar, strTitle, "KB971033", vbTextCompare) <> "0" then update.IsHidden = True end ifNextWScript.Quit Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now