Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: need script to automatically hide updates via the DataStore.edb file

22 Nov 2015   #1
elliot7

Windows 7 Ultimate x64
 
 
need script to automatically hide updates via the DataStore.edb file

Let's say I have several different updates I know I don't want. For example:
KB2952664 KB2976978 KB2977759 KB2990214 KB3021917 KB3035583

After a fresh install of Windows 7, there are a few hundred updates to be installed. I don't want to have to manually compare each update to my list of unwanted updates...

I would like a script or batch file which I can run before running Windows update for the first time, which will automatically mark these updates as hidden in the DataStore.edb file, so that I can just run all the updates without having to manually hide my unwanted updates.

It looks like maybe a solution can be put together using this information:

Mark A. Ziesemer: Scripted hiding of Windows Updates under Vista

This is slightly above my level of competence. Can anyone who is more familiar with this environment please comment as to how easy it would be to do what I want here?

Thank you!


My System SpecsSystem Spec
.
25 Nov 2015   #2
Pyprohly

Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
 
 

Hi Elliot,

Give the script below a try. Note that it may take a few moments for the Windows Update, Control Panel item to reflect changes the script makes.


HideUpdates.js
Code:
KB_list = "KB2952664 KB2976978 KB2977759 KB2990214 KB3021917 KB3035583"
KB_list = KB_list.split(' ')
 
function forceUseCScript() {
    if (WScript.FullName.slice(-11).toLowerCase() != 'cscript.exe') {
        var WshShell = new ActiveXObject('WScript.Shell')
        WshShell.Run('%ComSpec% /k "CScript.exe /nologo ' + '"' + WScript.ScriptFullName + '""', 1, false)
        WScript.Quit()
    }
}
 
function promptForElevation() {
    if (WshShell.Run('Net Sess', 0, true) != 0) {
        new ActiveXObject('Shell.Application').ShellExecute('WScript', '"' + WScript.ScriptFullName + '"', '', 'RunAs', 1)
        WScript.Quit()
    }
}
 
function remove_non_numeric(string) {
    return string.replace(/\D/g,'')
}
 
var WshShell = new ActiveXObject('WScript.Shell')
promptForElevation()
forceUseCScript()
 
KB_successfully_processed = {}
for (i in KB_list) {
    KB_successfully_processed[KB_list[i]] = false
}
 
var WU = new ActiveXObject('Microsoft.Update.Session')
var searcher = WU.CreateUpdateSearcher()
searcher.Online = false
criteria = "IsInstalled=0"
 
var search_results = searcher.Search(criteria).Updates
 
list_success = false; list_fail = false
for (i = 0; i < search_results.Count; i++) {
    for (j = 0; j < search_results.Item(i).KBArticleIDs.Count; j++) {
        for (k in KB_list) {
            if (remove_non_numeric(search_results.Item(i).KBArticleIDs(j)) == remove_non_numeric(KB_list[k])) {
                try {
                    //search_results.Item(i).IsHidden = true
                    WScript.Echo('Hid update ' + KB_list[k])
                    KB_successfully_processed[KB_list[k]] = true; list_success = true
                } catch (e) {
                    WScript.Echo('Unable to hide update ' + KB_list[k])
                    list_fail = true
                }
            }
        }
    }
}
/*
WScript.Echo('')
if (list_success) {
    WScript.Echo('\nUpdates hidden:')
    for (i in KB_successfully_processed) {
        if (KB_successfully_processed[i]) {WScript.Echo('\t'+i)}
    }
}
 
if (list_fail) {
    WScript.Echo('\nUpdates failed to hide:')
    for (i in KB_successfully_processed) {
        if (!KB_successfully_processed[i]) {WScript.Echo('\t'+i)}
    }
}
*/
My System SpecsSystem Spec
Reply

 need script to automatically hide updates via the DataStore.edb file




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Windows Script Host: Can not find script file ?
Hello & Thanks , win7 x64 Starting yesterday , I keep getting the following message: Windows Script Host Can not find script file "C:\ProgramData\{95137DD0-C591-AC56-7417-DCD4A4950F5A}\2.0.1.9\lare.txt". Any idea why and how to fix it ? Thanks/ ...Vern Tags: win7 x64, mobiles game,...
General Discussion
svchost.exe (netsvcs) using DataStore.edb
My PC seems to access DataStore.edb a lot, bringing my hard drive to a crawl for minutes at a time. It happens when I first boot up, and on and off as I use it throughout the day. What is triggering this to be accessed? Is there anything I can do to minimize this file being accessed so often? (no...
General Discussion
I need a .VBS script for a tool to save and automatically close
i want to make netpass.exe window automatically close after make his job and save the password list in a .TXT file Can anyone help me with that please? here the pack to work and test U can downlaod the tool from here: https://www.sendspace.com/file/rcj5oz ...
General Discussion
Can I force a user to log off automatically through a logon script?
Hi there I've trying to invoke a fix on the fly and have got a mixed windows workstation environment on my network. For particular reasons, I don't want my windows XP users to use a Windows 7 machine and equally I don't want a Windows 7 user to use a Windows XP machine. Silly I know but there...
Network & Sharing
Check Internet connectivity automatically via script and reconnect
Hi all I have a few computers that connect via rasdial to a bridged modem. They are dropping off randomly and frequently enough that its a pain to have to reset them manually everytime. Does anyone know how I could write a script or something that would check for internet connectivity and if...
Network & Sharing
How to automatically hide all of a certain file type in a folder tree?
I ask because I have just noticed that when I open WORD files that the newly generated WBK-files are visible despite me using the "attrib +h *.nfo /s" command previously. I foolishly hoped that also all future '*.wbk's would automatically be hidden too. Is there anything that I can do about it ...
Customization


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 03:32.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App