Monday, September 21, 2015

Remove all Printers Deployed from a specific Print Server with Powershell

I had a customer which had deployed printers from a legacy print server utilising scripts.  They have recently built a new 2012 R2 print server where they deployed the printers utilising Print Management Console and Group Policy.

All printers were redeployed from the new print server.

The customer however had a number of printers setup on workstations still pointing to the legacy print server.  As such they wanted to remove all printers deployed from the hostname of the legacy print server.

The following PowerShell script achieves this and can be easily deployed with Group Policy.  Simply replace "PRINTSERVER" with the name of your print server and then deploy the PowerShell script.

$PrintServer = "\\PRINTSERVER"
$Printers = Get-WmiObject -Class Win32_Printer
ForEach ($Printer in $Printers) {
If ($Printer.SystemName -like "$PrintServer") {
(New-Object -ComObject WScript.Network).RemovePrinterConnection($($Printer.Name))
}
}


 

1 comment:


  1. sql server 2008r2 enterprise keygen , windows 8 professional genuine activation key , free windpws 7 professional activation key , windows 10 activation 0x800705b4 , windows 7 ultimate sp1 keys , windows 10 activation issues 0xc004c003 , microsoft visio professional 2016 , windows 10 serial keys product key , svn3oa

    windows 10 pro key

    office 2013 pro key sale

    cheap visual studio key buy

    ReplyDelete