Windows 7 updates 15/4/14 problem

Soldato
Joined
14 Nov 2007
Posts
19,336
Location
In the Land of Grey and Pink
So there were a large amount of W7 updates last night which causes my PC to lock up shortly after getting to the desktop screen. Have had to do a system restore to recover.

Tried updating again with identical results. Anyone else having problems?
 
Have a look in task manager. You might need to clear the Ngen.exe's queue.

http://blogs.msdn.com/b/dotnet/arch...e-has-high-cpu-usage-you-can-speed-it-up.aspx

There is a VBS script you can use, but I can't find a download link for it. So I've listed the code below, you just need to save the file as "7318.DrainNGenQueue.wsf" (without quotes) and run it:
Code:
<package><job id="DrainNGenQueue.wsf">
<script language="JScript">    
    var wsh = WScript.CreateObject("WScript.Shell");
    var fso = WScript.CreateObject("Scripting.FileSystemObject");
    var is64bit = function () {
        if (wsh.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%").indexOf("64") > 0)
            return true;
        return (wsh.ExpandEnvironmentStrings("%PROCESSOR_ARCHITEW6432%").indexOf("64") > 0);
    }();
    var isV4Installed = function () {
        var v4NgenLoc = wsh.ExpandEnvironmentStrings("%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\ngen.exe");
        return fso.FileExists(v4NgenLoc);
    }();
    // Run an exe, collecting its exit code, stdout & stderr, optionally echoing the results to the window
    var runToCompletion = function (exe, arguments, echo) {
        var makeResult = function (exitCode, stdOut, stdErr) {
            return { ExitCode: exitCode, StdOut: stdOut, StdErr: stdErr };
        }
        var getStream = function (strm) {
            var line = "";
            if (!strm.AtEndOfStream) {
                line = strm.ReadAll();
                if (echo)
                    WScript.Echo(line);
            }
            return line;
        }
        var process = wsh.Exec(exe + " " + arguments);
        var output = "";
        var error = "";
        while (process.Status == 0) {
            WScript.Sleep(50);
            output += getStream(process.StdOut);
            error += getStream(process.StdErr);
        }
        output += getStream(process.StdOut);
        error += getStream(process.StdErr);
        return makeResult(process.ExitCode, output, error);
    }
    var ver = function () {
        var ver = runToCompletion(wsh.ExpandEnvironmentStrings("%windir%\\system32\\cmd.exe"), "/C ver");
        var rgx = / ([0-9]+)\.([0-9]+)\.[0-9]+/;
        var res = rgx.exec(ver.StdOut);
        return {major: res[1], minor :res[2]};
    }();
    // true if the OS version is 6.2 or later
    var isOSWin8OrLater = (ver.major == 6 && ver.minor >= 2) || (ver.major > 6);
    var preVista = (ver.major < 6);

    // This re-launches the script under an elevated cscript window if it's either
    // not already running as elevated, or it's running under wscript.exe instead.
    // Note that is doesn't pass any arguments, because this particular script doesn't have any
    var validateElevatedCScript = function () {

        // Return "Elevated", "Not elevated", "Unknown", or "Error" regarding elevation status
        var elevatedStatus = function () {
            if (preVista)
                return "Unknown";
            // From technet, translated from VBScript & munged
            var whoami = runToCompletion("whoami", "/groups", false);
            if (whoami.ExitCode == 0) {
                if (whoami.StdOut.indexOf("S-1-16-12288") >= 0) {
                    return "Elevated";
                } else if (whoami.StdOut.indexOf("S-1-16-8192") >= 0) {
                    return "Not elevated";
                } else {
                    return "Unknown";
                }
            } else if (whoami.StdErr.length != 0) {
                WScript.Echo(whoami.StdErr.ReadAll());
            }
            return "Error";
        }();

        var shell = WScript.CreateObject("Shell.Application");
        var scriptHost = WScript.FullName; // This is the path to cscript.exe or wscript.exe
        var wsfPath = WScript.ScriptFullName; // This is the full path to the .wsf file being run
        var isCScript = scriptHost.toLowerCase().indexOf("\\cscript.exe") >= 0;

        if (isCScript && elevatedStatus != "Not elevated")
            return;
        if (!isCScript)
            scriptHost = fso.GetParentFolderName(scriptHost) + "\\cscript.exe";
        if (preVista)
            shell.ShellExecute(scriptHost, "\"" + wsfPath + "\"");
        else
            shell.ShellExecute(scriptHost, "\"" + wsfPath + "\"", "", "runas", 1);
        WScript.Quit(0);
    }();

    var drainNGenQueue = function (ver) {
        var dotNetRoot = wsh.ExpandEnvironmentStrings("%windir%\\Microsoft.NET\\Framework");
        var getNGenBinary = function (is64Bit, ver) {
            return dotNetRoot + (is64Bit ? "64" : "") + "\\" + ver + "\\ngen.exe";
        }
        var ngen32 = getNGenBinary(false, ver);
        var ngen64 = getNGenBinary(true, ver);
        var argument = "executeQueuedItems";

        runToCompletion(ngen32, argument, true);
        if (is64bit)
            runToCompletion(ngen64, argument, true);
    }
    var drainAppStoreQueue = function () {
        var schTasks = wsh.ExpandEnvironmentStrings("%windir%\\System32\\schtasks.exe");
        var arguments = "/run /Tn \"\\Microsoft\\Windows\\.NET Framework\\.NET Framework NGEN v4.0.30319";
        runToCompletion(schTasks, arguments + "\"", true);
        if (is64bit)
            runToCompletion(schTasks, arguments + " 64\"", true);
    }

    drainNGenQueue(isV4Installed ? "v4.0.30319" : "v2.0.50727");
    if (isOSWin8OrLater) {
        drainAppStoreQueue();
    }
</script>
</job></package>
 
Do the basics.

Run chkdsk /f from a command prompt. Reboot.
Run sfc /scannow from a command prompt. Reboot.

- Disable any AV software you have installed.
- Go to Windows Update and install the updates one at a time.
- Start with the IE11 patches. Then move onto the Operating System fixes.
- Make sure no device driver updates have sneaked into the list. You generally don't want to take driver updates from Windows Update.
- Perform the .NET updates last. It's usually these that cause problem on old W7 installs.

The system readiness tool may also help in some circumstances: http://www.microsoft.com/en-gb/download/details.aspx?id=20858. Try running this after the chkdsk and sfc stages before you visit windows update.
 
Last edited:
Back
Top Bottom