Windows 7 CPU Hogging Problem (http://wu.krelay.de/en/)

Windows 7 CPU Hogging Problem (http://wu.krelay.de/en/)

Postby exportgoldman » 03.10.2016, 00:58

Hello,

I am trying to get hold DALAI from http://wu.krelay.de/en/ as I have written a vbs script which automates the downloading and installation of the fixes listed on DALAI's website to fix the CPU hogging and speed problems with Windows Update on Windows 7 SP1.

you can rename the txt file then run it with cscript e.g.

cscript W7WUCPUHogHotFix.vbs

I hope this helps. We use it with LabTech to push out the fixes before using the normal patching. The Script stops the windows Update Service then checks and installs the hotfixes.

Code: Select all
wscript.echo "*****************************************************************************"
wscript.echo "**   This Script installs all Required Hotfixes to Speed Up Windows 7 SP1  **"
wscript.echo "**        Windows Update Checking, including the CPU Hogging Hotfix        **"
wscript.echo "**                  Version 0.9 by tyler@incitevanuatu.com                 **"
wscript.echo "*****************************************************************************"
wscript.echo " "


Set WshShell = CreateObject("WScript.Shell")
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
OsType = WshShell.RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE")
Set environmentVars = WScript.CreateObject("WScript.Shell").Environment("Process")
DownloadPath = environmentVars("TEMP")

' CPU Hogging Hotfix
KB3102810x86 = "http://download.microsoft.com/download/A/0/9/A09BC0FD-747C-4B97-8371-1A7F5AC417E9/Windows6.1-KB3102810-x86.msu"
KB3102810x64 = "http://download.microsoft.com/download/F/A/A/FAABD5C2-4600-45F8-96F1-B25B137E3C87/Windows6.1-KB3102810-x64.msu"

' Need to also install all of these...
KB3185911x86 = "http://download.microsoft.com/download/6/E/8/6E884981-1D7B-4423-A845-56B805E59036/Windows6.1-KB3185911-x86.msu"
KB3185911x64 = "http://download.microsoft.com/download/2/B/C/2BC5C880-2920-47F1-8A64-4B1F1C1A8737/Windows6.1-KB3185911-x64.msu"

KB3168965x86 = "http://download.microsoft.com/download/4/2/0/420492DE-F382-4F18-839E-D4ADD8BF33E7/Windows6.1-KB3168965-x86.msu"
KB3168965x64 = "http://download.microsoft.com/download/B/E/D/BEDBE8C8-8EF2-4D8C-B55C-7D1554CA9500/Windows6.1-KB3168965-x64.msu"

KB3145739x86 = "http://download.microsoft.com/download/C/E/9/CE982A9D-C4C4-4355-B87A-1A72CCD0CC73/Windows6.1-KB3145739-x86.msu"
KB3145739x64 = "http://download.microsoft.com/download/8/D/7/8D75A16B-5BC0-457A-BE97-A93566AB82D6/Windows6.1-KB3145739-x64.msu"

KB3078601x86 = "http://download.microsoft.com/download/0/7/5/075F0E65-7F09-4554-B8FA-4F52D6E22172/Windows6.1-KB3078601-x86.msu"
KB3078601x64 = "http://download.microsoft.com/download/0/4/A/04A4348A-EB14-461C-B5B1-25EEBB1A24B8/Windows6.1-KB3078601-x64.msu"

KB3164033x86 = "http://download.microsoft.com/download/7/F/B/7FB02E92-9FDC-4E1D-9CC7-B8104880E4A3/Windows6.1-KB3164033-x86.msu"
KB3164033x64 = "http://download.microsoft.com/download/3/3/F/33FFD46F-ED25-49FE-B89F-EC6269568F9B/Windows6.1-KB3164033-x64.msu"

KB3109094x86 = "http://download.microsoft.com/download/A/2/7/A2783780-2A3B-4A35-A55E-71B0EAF79E0E/Windows6.1-KB3109094-x86.msu"
KB3109094x64 = "http://download.microsoft.com/download/A/4/8/A48BBC7A-8045-4ED7-A43F-FB5C9B686183/Windows6.1-KB3109094-x64.msu"

KB3138612x86 = "http://download.microsoft.com/download/E/4/7/E47FB37E-7443-4047-91F7-16DDDCF2955C/Windows6.1-KB3138612-x86.msu"
KB3138612x64 = "http://download.microsoft.com/download/B/7/C/B7CD3A70-1EA7-486A-9585-F6814663F1A9/Windows6.1-KB3138612-x64.msu"


' MAIN PROGRAM LOGIC

' Check for Windows 7 SP1 (Will also hit Windows Server 2008 R2 I think need to put additional check in.)
Set SystemSet = GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
for each System in SystemSet
   wscript.echo "Global   : " & System.Caption & "(Build " & System.Version & ")"
   If system.version <> "6.1.7601" then
      wscript.echo "ERROR   : Wrong Windows Version - Need Windows 7 Service Pack 1"
      wscript.quit
   end if
next

' Stop Windows Update, Check for Download and install some hotfixes.
StopWUService(OK)
   If OsType = "x86" then
      wscript.echo "Global   : Windows 32 Bit System Detected"
      wscript.echo "Global   : Download Location = " & DownloadPath
      Call InstallHotfix(KB3102810x86, "3102810")
      Call InstallHotfix(KB3185911x86, "3185911")
      Call InstallHotfix(KB3168965x86, "3168965")
      Call InstallHotfix(KB3145739x86, "3145739")
      Call InstallHotfix(KB3078601x86, "3078601")
      Call InstallHotfix(KB3164033x86, "3164033")
      Call InstallHotfix(KB3109094x86, "3109094")
      Call InstallHotfix(KB3138612x86, "3138612")
   elseif OsType = "AMD64" then
      wscript.echo "Global   : Windows 64 Bit System Detected"
      wscript.echo "Global   : Download Location = " & DownloadPath
      Call InstallHotfix(KB3102810x64, "3102810")
      Call InstallHotfix(KB3185911x64, "3185911")
      Call InstallHotfix(KB3168965x64, "3168965")
      Call InstallHotfix(KB3145739x64, "3145739")
      Call InstallHotfix(KB3078601x64, "3078601")
      Call InstallHotfix(KB3164033x64, "3164033")
      Call InstallHotfix(KB3109094x64, "3109094")
      Call InstallHotfix(KB3138612x64, "3138612")
   end if

StartWUService(OK)
wscript.echo "Result   : All Done"
wscript.echo "Result   : Please Advise User to Restart their PC if any updates were installed"
wscript.echo "Result   : YA! HAPPY PLACE"   
wscript.quit
 
 
 
Private Function InstallHotfix(MSUFileURL, HotFixID)
Dim objfso, objShell
If CheckParticularHotfix(strPuter,HotFixID) = False then
   LocalHotFixFile = DownloadFile(MSUFileURL, DownloadPath)
   Set objShell = CreateObject("Wscript.Shell")
         wscript.echo "Install  : Q" & HotFixID 
         iretval=objShell.Run ("wusa.exe " & LocalHotFixFile & " /quiet /norestart", 1, True)
         If (iRetVal = 0) or (iRetVal = 3010) then
            wscript.echo "Result   : Q" & HotFixID & " Install Success"
         Else
            wscript.echo "Result   : Q" & HotFixID & " Install FAILED"
         End If
End If
End Function


private Function CheckParticularHotfix(strPuter, strHotfixID)
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
    ' Version 1.0
    ' Checks if a particular hotfix is installed or not. 
    ' This function has these 3 return options:
    ' TRUE, FALSE, <error description> 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 
   wScript.echo "Checking : Q" & strHotfixID
    On error resume next
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\.\root\cimv2")
    if err.number <> 0 then
        CheckParticularHotfix = "WMI could not connect to local computer"
      wscript.echo "Checking : WMI could not connect to local computer"
        exit function 'No reason to continue
    end if
     
    strWMIforesp = "Select * from Win32_QuickFixEngineering where HotFixID = 'Q" & strHotfixID &_ 
    "' OR HotFixID = 'KB" & strHotfixID & "'"
    Set colQuickFixes = objWMIService.ExecQuery (strWMIforesp)
    if err.number <> 0 Then    'if an error occurs
        CheckParticularHotfix = "Unable to get WMI hotfix info"
      wscript.echo "ERROR    : Unable to get WMI hotfix info"
    else 'Error number 0 meaning no error occured 
        tal = colQuickFixes.count
        if tal > 0 then
            CheckParticularHotfix = True    'HF installed
         wscript.echo "Result   : Q" & strHotfixID & " Already Installed"
        else 
            CheckParticularHotfix = False    'HF not installed
         wscript.echo "Result   : Q" & strHotfixID & " NOT Installed"         
        end If
    end if
    Set colQuickFixes = Nothing
    Err.Clear
    On Error GoTo 0
end function



Private Function DownloadFile(DownloadURL, DownloadPath)
strLink = DownLoadURL
    ' Get file name from URL.
    ' http://download.windowsupdate.com/microsoftupdate/v6/wsusscan/wsusscn2.cab -> wsusscn2.cab
    strSaveName = Mid(strLink, InStrRev(strLink,"/") + 1, Len(strLink))
    strSaveTo = DownloadPath & "\" & strSaveName
   WScript.Echo "Download : " & strSaveName & " Started"

    ' Create an HTTP object
    Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )

    ' Download the specified URL
    objHTTP.Open "GET", strLink, False
    ' Use HTTPREQUEST_SETCREDENTIALS_FOR_PROXY if user and password is for proxy, not for download the file.
    ' objHTTP.SetCredentials "User", "Password", HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
    objHTTP.Send

         Set objFSO = CreateObject("Scripting.FileSystemObject")
     If objFSO.FileExists(strSaveTo) Then
       objFSO.DeleteFile(strSaveTo)
     End If

     If objHTTP.Status = 200 Then
       Dim objStream
       Set objStream = CreateObject("ADODB.Stream")
       With objStream
           .Type = 1 'adTypeBinary
           .Open
           .Write objHTTP.ResponseBody
           .SaveToFile strSaveTo
           .Close
       End With
       set objStream = Nothing
     End If

     If objFSO.FileExists(strSaveTo) Then
      WScript.Echo "Download : " & strSaveName & " Completed"
     End If
    DownloadFile = strSaveTo
End Function


Private Function StartWUService(ServiceName)
   wscript.echo "Service  : Starting Windows Update Service..."
   Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
   Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='wuauserv'")
   For Each objService in colListOfServices
   objService.StartService()
   Next

End Function

Private Function StopWUService(ServiceName)
   wscript.echo "Service  : Stopping Windows Update Service..."
   Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
   Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='wuauserv'")
   For Each objService in colListOfServices
   objService.StopService()
   Next
End Function
exportgoldman
 

Re: Windows 7 CPU Hogging Problem (http://wu.krelay.de/en/)

Postby epguy9 » 12.10.2016, 16:42

thanks.

although the script installing both KB3102810 & KB3138612 is not necessary as KB3138612 supersedes/replaces KB3102810 (and includes all previous WU client fixes).
If KB3138612 is already installed, KB3102810 won't get installed and is not needed at all.
epguy9
 
Posts: 22
Joined: 12.10.2016, 16:32
Location: USA


Return to Verschiedenes / Miscellaneous

Who is online

Users browsing this forum: No registered users and 45 guests