Share via


Powershell script to remove specific patches from different machines

Question

Friday, August 12, 2011 10:50 AM

Hi!

I am looking for a small script that can remove specific KB (Patch) from list of computers.

 

Thanks

All replies (5)

Saturday, August 13, 2011 5:34 PM ✅Answered

Use this function on a text file with a computer/line
http://techibee.com/powershell/powershell-uninstall-windows-hotfixesupdates/1084

Something like this:

$myComputers = Get-Content

"c:\scripts\mycomputers.txt"

foreach ($computer in $myComputers

) {

 Uninstall-HotFix -ComputerName $computer

-HotfixID KB123456

}

I havent tried this by my self, but It should work...

 

 

Regards, Fredrik Wall http://poweradmin.se/blog


Saturday, August 13, 2011 6:28 PM ✅Answered

Fredrik has given you a good solution, but I thought this article may help as well. Thanks to Boe Prox for pointing it to me; in a comment, Dusting Hedges rightly recommends PowerShell's Get-HotFix Cmdlet instead of the WMI path...  Robert Robelo  


Sunday, August 14, 2011 6:33 PM

Thanks Fredrik I will try this.


Wednesday, June 21, 2017 9:28 AM

Use this function on a text file with a computer/line
http://techibee.com/powershell/powershell-uninstall-windows-hotfixesupdates/1084

Something like this:

$myComputers =Get-Content

"c:\scripts\mycomputers.txt"

foreach ($computerin$myComputers) {

 Uninstall-HotFix-ComputerName $computer

-HotfixID KB123456

}

I havent tried this by my self, but It should work...

 

 

Regards, Fredrik Wall http://poweradmin.se/blog

-HotfixID : The term '-HotfixID' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Wednesday, June 21, 2017 3:48 PM

try 

enter-pssession

uninstall-packages

(May be it help, not testet)

Chris