Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Batch Update Uninstaller - Uninstall Forced Win10 & Telemetry
New Posts  All Forums:Forum Nav:

Batch Update Uninstaller - Uninstall Forced Win10 & Telemetry

post #1 of 394
Thread Starter 
post-flame-small.gif Batch Update Uninstaller v5.2.5 post-flame-small.gif
BatchUpdateUninstallerv5.2.5.zip 141k .zip file
Published March 16th, 2016
How to use:

  1. Run BatchUpdateUninstaller.cmd
  2. Type 1 and confirm.
  3. When the script completes, reboot. That's it! smile.gif


Recommendations:

  • It's highly recommended to set Windows Update to check for updates without downloading or installing, then uncheck Optional, and Microsoft Product updates.
  • To fully disable the remaining telemetry and CEIP that comes with Windows 7, 8.1, and 10, you can use Spybot Anti-Beacon.
  • Duplicate pending or old device updates can easily be removed. Here's my guide for using Device Remover.
  • Having issues with windows update? For Windows 8 users and above, Run Dism /Online /Cleanup-Image /RestoreHealth, then sfc /scannow until no errors are reported or up to three times, whichever comes first. Windows 7 does not use Dism commands, so use the System Update Readiness tool instead, then sfc /scannow. That solves whatever the problem may be the the majority of cases.
  • Our recommended text editor is Notepad++!
  • Want to view and manage the network traffic of all running processes? Check out NetLimiter! thumb.gif


Known issues:

  • Some updates such as KB2976978 are baked into different versions of Windows, and cannot be removed. KB2976978 cannot be removed from Windows 8 & 8.1.
  • Running Dism.exe /online /Cleanup-Image /StartComponentCleanup /ResetBase will make any currently installed updates permanently unable to be uninstalled.
  • I have insomnia and sometimes am too tired to update BUU when a new update needs blocking.



Current KB uninstall list:
Code:
To change what updates are uninstalled, you can add or remove KB IDs. One KB ID per line is all that is required for the script to function. Do not remove this line of text.
971033  - https://support.microsoft.com/en-us/kb/971033  - [Common Bug/Error/BSOD] [Win7] - Causes Windows to deactivate legitimate licences under certain circumstances.
2454826 - https://support.microsoft.com/en-us/kb/2454826 - [Common Bug/Error/BSOD] [Win7/Server 2008R2] - Claims to improve graphic performance, yet often causes crashes and BSODs.
2505438 - https://support.microsoft.com/en-us/kb/2505438 - [Common Bug/Error/BSOD] [Win7/Server 2008R2] - Claims to fix performance issues, yet often breaks fonts.
2882822 - https://support.microsoft.com/en-us/kb/2882822 - [Telemetry] [Win7SP1/Server 2008R2SP1] - Adds ITraceRelogger interface support.
2902907 - UPDATE REMOVED BY MS    https://bit.ly/1MftRyG - [MS Pulled] [Unknown] - KB ID previously used as a buggy WinXP MSE installer. Associated with telemetry updates, unanimously uninstalled.
2922324 - UPDATE REMOVED BY MS       NO SOURCE AVAILABLE - [MS Pulled] [Win7/8.1?] - Installed alongside telemetry updates. Pulled by MS.
2952664 - https://support.microsoft.com/en-us/kb/2952664 - [Get Win10] [Win7SP1] - Ease upgrade experience to the latest version of Windows.
2976978 - https://support.microsoft.com/en-us/kb/2976978 - [Telemetry] [Win8/8.1] - CEIP diagnostics and telemetry.
2976987 - UPDATE REMOVED BY MS       NO SOURCE AVAILABLE - [Get Win10] [Win7SP1/8.1] Update related to the 3035583 Get Windows X program.
2977759 - https://support.microsoft.com/en-us/kb/2977759 - [Telemetry] [Win7] - CEIP diagnostics and telemetry.
2990214 - https://support.microsoft.com/en-us/kb/2990214 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Enables you to upgrade to a later version of Windows.
2999226 - https://support.microsoft.com/en-us/kb/2999226 - [Unknown  ] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Enables Win10 universal CRT on earlier versions of windows.
3012973 - UPDATE REMOVED BY MS    https://bit.ly/1X8u9K4 - [Get Win10] [Win7SP1/8.1] - Installs Get Windows X program.
3014460 - UPDATE REMOVED BY MS    https://bit.ly/1LR8BJS - [Get Win10] [Win7SP1/Server 2008R2SP1] - Enables you to upgrade to a later version of Windows.
3015249 - UPDATE REMOVED BY MS       NO SOURCE AVAILABLE - [Telemetry] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Adds telemetry points to consent.exe and UAC.
3021917 - https://support.microsoft.com/en-us/kb/3021917 - [Telemetry] [Win7SP1] - CEIP diagnostics and telemetry.
3022345 - https://support.microsoft.com/en-us/kb/3022345 - [Telemetry] [Win7SP1/8.1/Server 2012R2] Installs CEIP diagnostics and telemetry. Replaced by KB3068708.
3035583 - https://support.microsoft.com/en-us/kb/3035583 - [Get Win10] [Win7SP1/8.1] - Installs Get Windows X program. Creates UAC backdoor.
3042058 - https://support.microsoft.com/en-us/kb/3042058 - [Telemetry] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Updates cipher suite priority order. Contains Windows logon spying elements.
3044374 - https://support.microsoft.com/en-us/kb/3044374 - [Get Win10] [Win8.1/Server 2012R2] - Enables you to upgrade to Win10.
3046480 - https://support.microsoft.com/en-us/kb/3046480 - [Telemetry] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Determines whether to migrate .NET 1.1 with upgrades to a later version of Windows.
3050265 - https://support.microsoft.com/en-us/kb/3050265 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to support upgrades to a later version of Windows.
3050267 - https://support.microsoft.com/en-us/kb/3050267 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to support upgrades to a later version of Windows.
3058168 - https://support.microsoft.com/en-us/kb/3058168 - [Get Win10] [Win8.1/Server 2012R2] - Enables KMS hosts to activate Win10.
3065987 - https://support.microsoft.com/en-us/kb/3065987 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. July 2015.
3064683 - https://support.microsoft.com/en-us/kb/3064683 - [Get Win10] [Win8.1] - Windows 8.1 OOBE modifications to reserve Windows 10.
3065988 - https://support.microsoft.com/en-us/kb/3065988 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client July 2015.
3068708 - https://support.microsoft.com/en-us/kb/3068708 - [Telemetry] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Installs CEIP diagnostics and telemetry.
3072318 - https://support.microsoft.com/en-us/kb/3072318 - [Get Win10] [Win8.1] - Windows 8.1 OOBE modifications to reserve Windows 10.
3074677 - https://support.microsoft.com/en-us/kb/3074677 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Compatibility update for upgrading to Windows 10. June 25th, 2015.
3075249 - https://support.microsoft.com/en-us/kb/3075249 - [Telemetry] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Adds telemetry points to consent.exe and UAC.
3075851 - https://support.microsoft.com/en-us/kb/3075851 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. August 2015
3075853 - https://support.microsoft.com/en-us/kb/3075853 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. August 2015.
3080149 - https://support.microsoft.com/en-us/kb/3080149 - [Telemetry] [Win7SP1/8.1/Server 2008R2SP1/Server 2012R2] - Updates CEIP diagnostics and telemetry match Win10.
3081437 - https://support.microsoft.com/en-us/kb/3081437 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Compatibility update for upgrading to Windows 10. August 18, 2015.
3081454 - https://support.microsoft.com/en-us/kb/3081454 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Compatibility update for upgrading to Windows 10. September 8, 2015.
3081954 - https://support.microsoft.com/en-us/kb/3081954 - [Telemetry] [Win7SP1] - Update for Work Folders improvements in Windows 7 SP1. Contains telemetry elements.
3086255 - https://support.microsoft.com/en-us/kb/3086255 - [Common Bug/Error/BSOD] [Win7SP1/Server 2008R2SP1/Win8.1/Server 2012R2] - Security update for the graphics component in Windows. Breaks SafeDisk.
3088195 - https://support.microsoft.com/en-us/kb/3088195 - [Telemetry] [Win7SP1/Server 2008R2SP1/Win8.1/Server 2012R2] - Security update for Windows Kernel. Reported to contain keylogger.
3083324 - https://support.microsoft.com/en-us/kb/3083324 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. September 2015.
3083325 - https://support.microsoft.com/en-us/kb/3083325 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. September 2015.
3083710 - https://support.microsoft.com/en-us/kb/3083710 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. October 2015.
3083711 - https://support.microsoft.com/en-us/kb/3083711 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. October 2015.
3090045 - https://support.microsoft.com/en-us/kb/3090045 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Windows Update for reserved devices.
3093983 - https://support.microsoft.com/en-us/kb/3093983 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Security update for Internet Explorer. IE spying.
3102810 - https://support.microsoft.com/en-us/kb/3102810 - [Get Win10] [Win7/Server 2008R2SP1] - High CPU usage occurs when installing and searching for updates. Windows 10 upgrade elements.
3102812 - https://support.microsoft.com/en-us/kb/3102812 - [Get Win10] [Win8.1/Server 2012R2] - High CPU usage occurs when installing and searching for updates. Windows 10 upgrade elements.
3112336 - https://support.microsoft.com/en-us/kb/3112336 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. December 2015.
3112343 - https://support.microsoft.com/en-us/kb/3112343 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. December 2015.
3123862 - https://support.microsoft.com/en-us/kb/3123862 - [Get Win10] [Win7SP1/8.1] - Updated capabilities to upgrade Windows 8.1 and Windows 7.
3135445 - https://support.microsoft.com/en-us/kb/3135445 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. February 2016.
3135449 - https://support.microsoft.com/en-us/kb/3135449 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. February 2016.
3138612 - https://support.microsoft.com/en-us/kb/3138612 - [Get Win10] [Win7SP1/Server 2008R2SP1] - Improvements to Windows Update Client. March 2016.
3138615 - https://support.microsoft.com/en-us/kb/3138615 - [Get Win10] [Win8.1/Server 2012R2] - Improvements to Windows Update Client. March 2016.
3139929 - https://support.microsoft.com/en-us/kb/3139929 - [Get Win10] [Win7/8.1/Server 2008R2SP1/Server 2012R2] - Security update for Internet Explorer. Implements Windows 10 ad generator into IE VIA bundled update KB3146449.

↓ ORIGINAL POST ↓
Warning: Spoiler! (Click to show)
I'm trying to uninstall and hide some windows updates using the method shown here: https://superuser.com/questions/922068/how-to-disable-the-get-windows-10-icon-shown-in-the-notification-area-tray/922921#922921
Except I want it to include this list of updates: [isleaked.com is down for good] https://fix10.isleaked.com/oldwindows.html (Note: KB2990214 is listed twice under different OS versions).

I'm not a programmer. I know almost nothing of programming or code, except that it can be so amazingly complicated. Mad respect to those who dedicate their lives to this stuff. I couldn't do it.

I'll copy the whole post (minus one small typo) in case there is link rot in the future.
Quote:
There are various ways to remove the GWX promotion "interactively" (in GUI mode).
However, I prefer to do it programmatically / the scripted way.

On my Win7 environments (in "workgroup" mode) I'm using the below scripts to achieve the following:

"uninstall" any suspect windows update
"hide" it from future update runs
"BlockWindows10.bat":
Code:
ECHO OFF
REM --- remember to invoke from ELEVATED command prompt!
REM --- or start the batch with context menu "run as admin".
SETLOCAL

REM --- (as of 2015-08-28):
REM  KB3035583 - GWX Update installs Get Windows 10 app in Windows 8.1 and Windows 7 SP1
REM  KB3021917 - Update to Windows 7 SP1 for performance improvements
REM  KB3012973 - Upgrade to Windows 10 Pro

REM --- no longer blocking:
REM  KB2952664 - Compatibility update for upgrading Windows 7
REM  KB2976978 - Compatibility update for Windows 8.1 and Windows 8
REM  KB3022345 - Telemetry [Replaced by KB3068708]
REM  KB3068708 - Update for customer experience and diagnostic telemetry

REM --- uninstall updates
echo uninstalling updates ...
start "title" /b /wait wusa.exe /kb:3021917 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3035583 /uninstall /quiet /norestart
echo  - done.
timeout 10

REM --- hide updates
echo hiding updates ...
start "title" /b /wait cscript.exe "%~dp0HideWindowsUpdates.vbs" 3021917 3035583 3012973
echo  - done.

echo ... COMPLETED (please remember to REBOOT windows, now)
pause
REM --- EOF

"HideWindowsUpdates.vbs" (Kudo http://serverfault.com/a/341318):
Code:
'// Inspired by Colin Bowern: http://serverfault.com/a/341318
If Wscript.Arguments.Count < 1 Then
    WScript.Echo "Syntax: HideWindowsUpdates.vbs [KB1] [KB2] ..." & vbCRLF & _
        " - Example1: HideWindowsUpdates.vbs 3035583" & vbCRLF & _
        " - Example2: HideWindowsUpdates.vbs 3035583 3012973"
    WScript.Quit 1
End If

Dim objArgs
Set objArgs = Wscript.Arguments
Dim updateSession, updateSearcher
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateUpdateSearcher()

Wscript.Stdout.Write "Searching for pending updates..." 
Dim searchResult
Set searchResult = updateSearcher.Search("IsInstalled=0")

Dim update, kbArticleId, index, index2
WScript.Echo CStr(searchResult.Updates.Count) & " found."
For index = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(index)
    For index2 = 0 To update.KBArticleIDs.Count - 1
        kbArticleId = update.KBArticleIDs(index2)

        For Each hotfixId in objArgs
            If kbArticleId = hotfixId Then
                If update.IsHidden = False Then
                    WScript.Echo "Hiding update: " & update.Title
                    update.IsHidden = True
                Else
                    WScript.Echo "Already hidden: " & update.Title
                End If          
            End If
        Next

    Next
Next
'// EOF

Ok so here is my bat file which I have renamed Remove WU Spyware:
Code:
ECHO OFF
REM --- remember to invoke from ELEVATED command prompt!
REM --- or start the batch with context menu "run as admin".
SETLOCAL

REM --- (as of 2015-09-06):
REM  KB2976978 - Telemetry for Win8/8.1
REM  KB3075249 - Telemetry for Win7/8.1
REM  KB3080149 - Telemetry for Win7/8.1
REM  KB3021917 - Telemetry for Win7
REM  KB3022345 - Telemetry
REM  KB3068708 - Telemetry
REM  KB3044374 - Get Windows 10 for Win8.1
REM  KB3035583 - Get Windows 10 for Win7sp1/8.1
REM  KB2990214 - Get Windows 10 for Win7
REM  KB2952664 - Get Windows 10 assistant
REM  KB3075853 - Update for "Windows Update" on Win8.1/Server 2012R2
REM  KB3065987 - Update for "Windows Update" on Win7/Server 2008R2
REM  KB3050265 - Update for "Windows Update" on Win7
REM  KB3075851 - Update for "Windows Update" on Win7
REM  KB2902907 - Description is not available

REM --- uninstall updates
echo uninstalling updates ...
start "title" /b /wait wusa.exe /kb:2976978  /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3075249 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3080149 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3021917 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3022345 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3068708 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3044374 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3035583 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:2990214 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:2952664 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3075853 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3065987 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:3050265 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:971033 /uninstall /quiet /norestart
echo  - next
start "title" /b /wait wusa.exe /kb:2902907 /uninstall /quiet /norestart
echo  - done.
timeout 10

REM --- hide updates
echo hiding updates ...
start "title" /b /wait cscript.exe "%~dp0HideWindowsUpdates.vbs" 2976978 3075249 3080149 3021917 3022345 3068708 3044374 3035583 2990214 2952664 3075853 3065987 3050265 971033 2902907
echo  - done.

echo ... COMPLETED (please remember to REBOOT windows, now)
pause
REM --- EOF

And here is my HideWindowsUpdates.vbs I have no idea how the syntax works here. It's too much to deduce with no experience by just looking at it.

The problem is I don't know what to do about the bit with "Example1 and Example2". What do I rename the examples? I deleted the lines since they were examples but that caused an unexpected end of file error. Was I supposed to keep the [KB1 [KB2] and continue on for the number of KB's I'm listing And instead use example 2 to list them? It's probably something simple, I just don't know the syntax.
Code:
// Inspired by Colin Bowern: http://serverfault.com/a/341318
If Wscript.Arguments.Count < 1 Then
    WScript.Echo "Syntax: HideWindowsUpdates.vbs [KB2976978] [KB3075249] [KB3080149] [KB3021917] [KB3022345] [KB3068708] [KB3044374] [KB3035583] [KB2990214] [KB2952664] [KB3075853] [KB3065987] [KB3050265] [KB3075851] [KB2902907] ..." & vbCRLF & _
    " - Example1: HideWindowsUpdates.vbs 3035583" & vbCRLF & _
    " - Example2: HideWindowsUpdates.vbs 3035583 3012973"
    WScript.Quit 1
End If

Dim objArgs
Set objArgs = Wscript.Arguments
Dim updateSession, updateSearcher
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateUpdateSearcher()

Wscript.Stdout.Write "Searching for pending updates..." 
Dim searchResult
Set searchResult = updateSearcher.Search("IsInstalled=0")

Dim update, kbArticleId, index, index2
WScript.Echo CStr(searchResult.Updates.Count) & " found."
For index = 0 To searchResult.Updates.Count - 1
    Set update = searchResult.Updates.Item(index)
    For index2 = 0 To update.KBArticleIDs.Count - 1
        kbArticleId = update.KBArticleIDs(index2)

        For Each hotfixId in objArgs
            If kbArticleId = hotfixId Then
                If update.IsHidden = False Then
                    WScript.Echo "Hiding update: " & update.Title
                    update.IsHidden = True
                Else
                    WScript.Echo "Already hidden: " & update.Title
                End If          
            End If
        Next

    Next
Next
// EOF

EDIT: Now with more colors!

Edited by cookieboyeli - 5/10/16 at 7:32pm
post #2 of 394
Thread Starter 
Bump?
post #3 of 394
The example section you're referring to, was just a block of text that would be displayed if the .vbs was called with no arguments (i.e. kb numbers). Essentially telling the user that hey this is how this should be called. If you only deleted those two lines and left the _ on the line above, the script will throw an error as it's looking for the line to continue.
If you really want to leave those lines out, it should look like this for that section:
Code:
If Wscript.Arguments.Count < 1 Then
    WScript.Echo "Syntax: HideWindowsUpdates.vbs [KB2976978] [KB3075249] [KB3080149] [KB3021917] [KB3022345] [KB3068708] [KB3044374] [KB3035583] [KB2990214] [KB2952664] [KB3075853] [KB3065987] [KB3050265] [KB3075851] [KB2902907] ..."
    WScript.Quit 1
End If

And having all of those uninstall's hard coded...ugh.
Edited by agawthrop - 9/6/15 at 10:06pm
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
post #4 of 394
Thread Starter 
Quote:
Originally Posted by agawthrop View Post

The example section you're referring to, was just a block of text that would be displayed if the .vbs was called with no arguments (i.e. kb numbers). Essentially telling the user that hey this is how this should be called. If you only deleted those two lines and left the _ on the line above, the script will throw an error as it's looking for the line to continue.
If you really want to leave those lines out, it should look like this for that section:
Code:
If Wscript.Arguments.Count < 1 Then
    WScript.Echo "Syntax: HideWindowsUpdates.vbs [KB2976978] [KB3075249] [KB3080149] [KB3021917] [KB3022345] [KB3068708] [KB3044374] [KB3035583] [KB2990214] [KB2952664] [KB3075853] [KB3065987] [KB3050265] [KB3075851] [KB2902907] ..."
    WScript.Quit 1
End If

And having all of those uninstall's hard coded...ugh.

Thank you!!
Look it worked! biggrin.gif (I think?)




What do you mean by "having all of those uninstall's hard coded"?
I read there are ID's you can link them to just in case there are new revisions made and rolled out, but that sounded like a lot of work.

EDIT: How did you get your code colored like that? Is there a way to select for different languages?
Edited by cookieboyeli - 9/6/15 at 10:22pm
post #5 of 394
Quote:
Originally Posted by cookieboyeli View Post

What do you mean by "having all of those uninstall's hard coded"?
I read there are ID's you can link them to just in case there are new revisions made and rolled out, but that sounded like a lot of work.

EDIT: How did you get your code colored like that? Is there a way to select for different languages?

I would have stored the KB's in a text file and then in the batch file looped through the text file and uninstalled each KB. I would've used a similar process in the vbs file for hiding the updates as well. It would eliminate the need for editing the code every time a new KB needs to added to the list. Plus it would just look a lot cleaner.

As for the color coding, your batch script is color coded. I think the reason your vbs code block is not is because of the ' before the // on the first and last lines.
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
post #6 of 394
Thread Starter 
Quote:
Originally Posted by agawthrop View Post

Quote:
Originally Posted by cookieboyeli View Post

What do you mean by "having all of those uninstall's hard coded"?
I read there are ID's you can link them to just in case there are new revisions made and rolled out, but that sounded like a lot of work.

EDIT: How did you get your code colored like that? Is there a way to select for different languages?

I would have stored the KB's in a text file and then in the batch file looped through the text file and uninstalled each KB. I would've used a similar process in the vbs file for hiding the updates as well. It would eliminate the need for editing the code every time a new KB needs to added to the list. Plus it would just look a lot cleaner.

As for the color coding, your batch script is color coded. I think the reason your vbs code block is not is because of the ' before the // on the first and last lines.
That's a lot easier to look at with he colors.

Yea there was a lot of tedious copy pasting. I started wondering if that was really the most efficient way since the same thing is written so many times...
But remember, I just copy pasted this. I have no skills whatsoever in this subject, in fact I consider it a small miracle that I actually got so close before asking for help.

I am interested in rewriting it to work how you say though. I have no doubt I'll have to add to the list numerous times throughout the ages.
So precisely how would I start? I did have a basic batch file but I deleted it. Let me see if I can recreate it...

EDIT: It was basically this for all files:
Code:
start /w wusa.exe /uninstall /kb:2976978 /quiet /norestart
start /w wusa.exe /uninstall /kb:3075249 /quiet /norestart
start /w wusa.exe /uninstall /kb:3080149 /quiet /norestart
exit

But you're talking even mroe basic aren't you, like just:
Code:
KB2976978
KB3075249
KB3080149

And then the meat and potatoes goes elsewhere to be left alone.
Edited by cookieboyeli - 9/6/15 at 11:24pm
post #7 of 394
That's correct. I'll work on a little something for you.
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
post #8 of 394
Thread Starter 
Quote:
Originally Posted by agawthrop View Post

That's correct. I'll work on a little something for you.
Thanks. biggrin.gif I didn't want to ask directly.

Hopefully I will be able to understand it. This is honestly pretty interesting. It's keeping my attention more than any other attempt so far.
post #9 of 394
So I've come up with the following bat file and vbs file along with a txt file that contains the list of updates. Please note that I have not been able to fully test as I am on Windows 10.

Batch File (UninstallWinUpdates.bat):
Code:
@echo off
cls
Title "Uninstall and Hide Windows Updates"

Set @kbList=%~dp0kbList.txt
Set @uhwuScript=%~dp0UninstallWinUpdates.vbs

goto verifyPrivileges

REM verifies that the CMD window has been opened with proper privileges
:verifyPrivileges
        ECHO Administrative privileges required. Verifying privileges...
        net session >nul 2>&1
        if %errorLevel% == 0 (
                ECHO Privileges verified.
                goto verifyKBList
        ) else (
                ECHO Pivileges not verified.  Please close CMD and run with administrator privileges.
                goto Exit
        )

REM verifies that the kbList text file exists
:verifyKbList
        ECHO Checking for list of Windows Updates (kbList.txt)...
        If exist %~dp0\kbList.txt (
                set @kbList=%~dp0kbList.txt
                goto uninstallUpdates
        ) else (
                ECHO The file kbList.txt is required for this program to run and should
                ECHO contain the list of KBs that are to be uninstalled and hidden.
                ECHO Each KB should be listed on a separate line. The file should be
                ECHO saved in the same directory as the .bat file.
                goto Exit
        )

REM calls vbscript to uninstall and hide updates listed in kbList.txt
:uninstallUpdates
        ECHO Launching UninstallWinUpdates.vbs...
        C:\Windows\SysWOW64\cscript.exe //nologo %@uhwuScript% %@kbList%
        ECHO Updates have been uninstalled and hidden.
        ECHO Please RESTART Windows now.
        goto Exit

:Exit
        ECHO This program will close in 30 seconds
        TIMEOUT /t 30
        Exit

VBScript File (UninstallWinUpdates.vbs):
Code:
On Error Resume Next
Dim fso, kbList, kb, kbID, kbArray()


'Pull the KBs from kbList.txt into an Array
Set fso = CreateObject("Scripting.FileSystemObject")
Set kbList = fso.OpenTextFile(WScript.Arguments(0))
i=0
Do Until kbList.AtEndOfStream
        'skips the first 3 lines of kbList.txt due to instructions
        If i <= 2 Then 
                kbList.ReadLine
        Else    
                kb = kbList.ReadLine
                Redim Preserve kbArray(i-3) 'i-3 because we skip the first three lines of text
                kbArray(i-3) = Left(kb,7)
        End If
        i = i+1
Loop

'Loop through each KB in list and uninstall if installed
WScript.Echo "Uninstalling Updates..."
For Each kbID in kbArray
        uninstallKb(kbID)
Next
Wscript.Echo "Updates have been Uninstalled."

'Hide the updates
WScript.Echo "Hiding Updates..."
hideUpdates(kbArray)
WScript.Echo "Updates have been hidden."

'Funtion to uninstall the KB
Function uninstallKb(kbID)
        Dim objShell
        If getKbID(kbID)= True Then
                Set objShell = CreateObject("wscript.shell")
                WScript.StdOut.Write "Uninstalling KB" & kbID & "..."
                objShell.Run "Cmd /c wusa.exe /uninstall /KB:" & kbID & " /quiet /norestart",,True
                If getKbID(kbID) Then
                        Wscript.Echo "Failed"
                Else
                        Wscript.Echo "Completed"
                End If
        Else
                Wscript.Echo "Update KB" & kbID & " is not installed."
        End If  
End Function

'Function to check if the current KB is installed
Function getKbID(kbID)
        Dim strComputer, objService, Items, Item
        strComputer = "."     
        Set objService = GetObject("winmgmts:{impersonateLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set Items = objService.ExecQuery("Select * from Win32_QuickFixEngineering where HotFixID = 'KB" & kbID & "'")
        For Each Item in Items
                If InStr(UCase(Item.HotFixID),UCase("KB" & kbID)) > 0 Then
                        Installed = True
                End If
        Next
        If Installed Then
                getkbID = True
        Else
                getkbID = False
        End If
End Function

'Function searches for uninstalled KBs
'Credit for this function goes to someone else (not sure who?)
Function hideUpdates(kbArray)
        Dim uSession, uSearcher, uResults, uItem, uItemID, i2, i3
        Set uSession = CreateObject("Microsoft.Update.Session")
        Set uSearcher = uSession.CreateUpdateSearcher()
        Wscript.StdOut.Write "Searching for pending updates..."
        Set uResults = uSearcher.Search("IsInstalled=0")
        Wscript.Echo Cstr(uResults.Updates.Count) & " found."
        For i2 = 0 To uResults.Updates.Count - 1
                Set uItem = uResults.Updates.Item(i2)
                For i3 = 0 To uItem.KBArticleIDs.Count - 1
                        uItemID = uItem.KBArticleIDs(i3)
                        For Each kb in kbArray
                                If uItemID = kb Then
                                        If uItem.IsHidden = False Then
                                                Wscript.StdOut.Write "Hiding update KB" & kb & "..."
                                                uItem.IsHidden = True
                                                Wscript.Echo "Hidden"
                                        Else
                                                WScript.Echo "Update KB" & kb & " already hidden"
                                        End If
                                End If
                        Next
                Next
        Next
End Function

Text file (kbList.txt):
Code:
This file is used to store all of the KB article numbers and info.
The KB number must be first, and one KB per line
ex. 2976978 - Telemetry for Win8/8.1
2976978 - Telemetry for Win8/8.1
3075249 - Telemetry for Win7/8.1
3080149
3021917
3022345
3068708

I've also attached the files in a zipped folder.
EDIT: Made some minor corrections to code above and reattached the file.
UninstallUpdates.zip 3k .zip file
Edited by agawthrop - 9/7/15 at 3:50pm
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
First Build
(12 items)
 
  
CPUMotherboardGraphicsRAM
Intel Core i5 4690K Asus Z97-A Gigabyte GeForce GTX 970 mini Crucial 8GB 
Hard DriveHard DriveOptical DriveOS
Samsung SSD 840 EVO 250GB Western Digital Blue 1TB LG DVD Burner Windows 8.1 Pro 
KeyboardPowerCaseMouse
Logitech K800 Seasonic 550W Corsair Carbide SPEC-02 Logitech G700s 
  hide details  
Reply
post #10 of 394
Thread Starter 
It works really well. Much cleaner.

I tweaked it a little to reduce the delay to 8 seconds since that just seems right and added punctuation tor the exit message.

Batch File (UninstallWinUpdates.bat):
Code:
@echo off
cls
Title "Uninstall and Hide Windows Updates"

Set @kbList=%~dp0kbList.txt
Set @uhwuScript=%~dp0UninstallWinUpdates.vbs

goto verifyPrivileges

REM verifies that the CMD window has been opened with proper privileges
:verifyPrivileges
        ECHO Administrative privileges required. Verifying privileges...
        net session >nul 2>&1
        if %errorLevel% == 0 (
                ECHO Privileges verified.
                goto verifyKBList
        ) else (
                ECHO Pivileges not verified.  Please close CMD and run with administrator privileges.
                goto Exit
        )

REM verifies that the kbList text file exists
:verifyKbList
        ECHO Checking for list of Windows Updates (kbList.txt)...
        If exist %~dp0\kbList.txt (
                set @kbList=%~dp0kbList.txt
                goto uninstallUpdates
        ) else (
                ECHO The file kbList.txt is required for this program to run and should
                ECHO contain the list of KBs that are to be uninstalled and hidden.
                ECHO Each KB should be listed on a separate line. The file should be
                ECHO saved in the same directory as the .bat file.
                goto Exit
        )

REM calls vbscript to uninstall and hide updates listed in kbList.txt
:uninstallUpdates
        ECHO Launching UninstallWinUpdates.vbs...
        C:\Windows\SysWOW64\cscript.exe //nologo %@uhwuScript% %@kbList%
        ECHO Updates have been uninstalled and hidden.
        ECHO Please RESTART Windows now.
        goto Exit

:Exit
        ECHO This program will close in 8 seconds.
        TIMEOUT /t 8
        Exit

I reduced the KB list instruction to two lines only since it seemed obvious.
I think yours got cut off a bit but I completed it. Now I need to find a site or forum that analyzes updates as they come out so I know what new ones to block when they come out.

Text file (kbList.txt):
Code:
This file is used to store all of the KB article numbers and info.
The KB number must be first, and one KB per line.
2976978 - Telemetry for Win8/8.1
3075249 - Telemetry for Win7/8.1
3080149 - Telemetry for Win7/8.1
3021917 - Telemetry for Win7
3022345 - Telemetry
3068708 - Telemetry
3044374 - Get Windows 10 for Win8.1
3035583 - Get Windows 10 for Win7sp1/8.1
2990214 - Get Windows 10 for Win7
2952664 - Get Windows 10 assistant
3075853 - Update for "Windows Update" on Win8.1/Server 2012R2
3065987 - Update for "Windows Update" on Win7/Server 2008R2
3050265 - Update for "Windows Update" on Win7
3075851 - Update for "Windows Update" on Win7
2902907 - Description is not available

To make that work I tweaked the VBS script. I'm not 100% certain that it's adjusted to ignore 2 lines instead of 3 since there are some i3's and i2's at the bottom. They don't seem related though and don't have hyphens so I think it's good.

VBScript File (UninstallWinUpdates.vbs):
Code:
On Error Resume Next
Dim fso, kbList, kb, kbID, kbArray()


'Pull the KB's from kbList.txt into an Array
Set fso = CreateObject("Scripting.FileSystemObject")
Set kbList = fso.OpenTextFile(WScript.Arguments(0))
i=0
Do Until kbList.AtEndOfStream
        'skips the first 2 lines of kbList.txt due to instructions
        If i <= 2 Then 
                kbList.ReadLine
        Else    
                kb = kbList.ReadLine
                Redim Preserve kbArray(i-2) 'i-2 because we skip the first three lines of text
                kbArray(i-2) = Left(kb,7)
        End If
        i = i+1
Loop

'Loop through each KB in list and uninstall if installed
WScript.Echo "Uninstalling Updates..."
For Each kbID in kbArray
        uninstallKb(kbID)
Next
Wscript.Echo "Updates have been Uninstalled."

'Hide the updates
WScript.Echo "Hiding Updates..."
hideUpdates(kbArray)
WScript.Echo "Updates have been hidden."

'Funtion to uninstall the KB
Function uninstallKb(kbID)
        Dim objShell
        If getKbID(kbID)= True Then
                Set objShell = CreateObject("wscript.shell")
                WScript.StdOut.Write "Uninstalling KB" & kbID & "..."
                objShell.Run "Cmd /c wusa.exe /uninstall /KB:" & kbID & " /quiet /norestart",,True
                If getKbID(kbID) Then
                        Wscript.Echo "Failed"
                Else
                        Wscript.Echo "Completed"
                End If
        Else
                Wscript.Echo "Update KB" & kbID & " is not installed."
        End If  
End Function

'Function to check if the current KB is installed
Function getKbID(kbID)
        Dim strComputer, objService, Items, Item
        strComputer = "."     
        Set objService = GetObject("winmgmts:{impersonateLevel=impersonate}!\\" & strComputer & "\root\cimv2")
        Set Items = objService.ExecQuery("Select * from Win32_QuickFixEngineering where HotFixID = 'KB" & kbID & "'")
        For Each Item in Items
                If InStr(UCase(Item.HotFixID),UCase("KB" & kbID)) > 0 Then
                        Installed = True
                End If
        Next
        If Installed Then
                getkbID = True
        Else
                getkbID = False
        End If
End Function

'Function searches for uninstalled KBs
'Credit for this function goes to someone else (not sure who?)
Function hideUpdates(kbArray)
        Dim uSession, uSearcher, uResults, uItem, uItemID, i2, i3
        Set uSession = CreateObject("Microsoft.Update.Session")
        Set uSearcher = uSession.CreateUpdateSearcher()
        Wscript.StdOut.Write "Searching for pending updates..."
        Set uResults = uSearcher.Search("IsInstalled=0")
        Wscript.Echo Cstr(uAvail.Updates.Count) & " found."
        For i2 = 0 To uResults.Updates.Count - 1
                Set uItem = uResults.Updates.Item(i2)
                For i3 = 0 To uItem.KBArticleIDs.Count - 1
                        uItemID = uItem.KBArticleIDs(i3)
                        For Each kb in kbArray
                                If uItemID = kb Then
                                        If uItem.IsHidden = False Then
                                                Wscript.StdOut.Write "Hiding update KB" & kb & "..."
                                                uItem.IsHidden = True
                                                Wscript.Echo "Hidden"
                                        Else
                                                WScript.Echo "Update KB" & kb & " already hidden"
                                        End If
                                End If
                        Next
                Next
        Next
End Function

Now I was wondering, how viable is it to get some status feedback on each KB? Like:
Code:
KB3035583 has been uninstalled.

Or
Code:
KB3035583 is not installed/present.

That would take a crazy amount of work though right? You'd have to code separate "sections/things" to check if it's uninstalled or just hidden, and then setup messages accordingly. But one "section/thing" would be able to give feedback on whether or not it's installed or uninstalled since that's just a 0 or 1 right? And if checking each "status" is done similarly you could almost copy and paste sections to check/report hidden status and downloaded status. But I'm sure there's a way to switch between different statuses to check rather than make a new checking/status output section for each... so maybe it isn't a massive amount. What do you think?

The VBS file is wicked complicated and new to me, I can only decipher/deduce some of it.

EDIT: I've switched to Notepad++ from Notepad2. It's helping already since it color codes much better. It's got some cool themes too which are much easier to look at.
Edited by cookieboyeli - 9/7/15 at 5:43pm
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Batch Update Uninstaller - Uninstall Forced Win10 & Telemetry