Trevor's script will remove all hotfixes, I just want to remove the ones I have listed in the array.
$PatchList = @("KB2553154","KB2899519","KB2910902","KB3008923","KB3012176","KB3013126") Jerry Lai Systems Engineer, Desktop Management Herbert Smith Freehills T +61 3 9288 1780 M +61 4198 9461 F +61 3 9288 1567 www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/> linkedin.com/in/JerryLaiHSF<http://www.linkedin.com/in/jerrylaihsf> From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of E.J. Cramer Sent: Tuesday, 13 January 2015 8:42 PM To: scripting@lists.myitforum.com Subject: [scripting] RE: Powershell - Uninstall Microsoft Updates I use this one to deinstall hotfixes. Perhaps its of use for you. # Author: Trevor Sullivan # Date: 5/25/11 # Purpose: Uninstall all software updates # Notes: wusa.exe kicks off asynchronously # Get a list of all installed hotfixes $PatchList = Get-Hotfix # Iterate over list of hotfixes foreach ($Patch in $PatchList) { # Write-Host $Patch.HotfixId # If the HotfixID property contains any text, remove it (some do, some don't) $KBNumber = $Patch.HotfixId.Replace("KB", ""); # Write-Host $KBNumber # Build our command line for removing the update $RemovalCommand = "wusa.exe /uninstall /kb:$KBNumber /quiet /log /norestart"; Write-Host ("Removing update with command: " + $RemovalCommand); # Invoke the command we built above Invoke-Expression -Command $RemovalCommand; # Wait for wusa.exe to finish and exit (wusa.exe actually leverages # TrustedInstaller.exe, so you won't see much activity within the wusa process) while (@(Get-Process wusa -ErrorAction SilentlyContinue).Count -ne 0) { Start-Sleep 1 Write-Host "Waiting for update removal to finish ..." } } From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Lai, Jerry Sent: dinsdag 13 januari 2015 10:37 To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com> Subject: [scripting] Powershell - Uninstall Microsoft Updates I have a PS script that when I launch interactively/manually, it runs perfectly fine from the NETLOGON share. But When I add it into the GPO computer logon/start up script, it doesn't work?? Do I need to some services started before I can run this PS script to uninstall MS Updates? Thanks in advanced, Jerry Jerry Lai Systems Engineer, Desktop Management Herbert Smith Freehills T +61 3 9288 1780 M +61 4198 9461 F +61 3 9288 1567 www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/> linkedin.com/in/JerryLaiHSF<http://www.linkedin.com/in/jerrylaihsf> Herbert Smith Freehills LLP and its subsidiaries and Herbert Smith Freehills, an Australian Partnership, are separate member firms of the international legal practice known as Herbert Smith Freehills. This message is confidential and may be covered by legal professional privilege. If you are not the intended recipient you must not disclose or use the information contained in it. If you have received this email in error please notify us immediately by return email or by calling our main switchboard on +612 9225 5000 and delete the email. Further information is available from www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>. ________________________________ AMC Disclaimer : http://www.amc.nl/disclaimer<http://scanmail.trustwave.com/?c=4500&d=7ui01FB3G_XEk7guylUZtsYN1Y8QLWiy2jZk-6VeIg&u=http%3a%2f%2fwww%2eamc%2enl%2fdisclaimer> ________________________________