Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Delete filtered printer

$
0
0

I want topublisha scriptviaGPO.The scriptshould check whetherthe computerprintera particularprint server"printserverA"hasconnectedandthendelete themproperly.However,all local printersand printerto be retainedby the"printserverB"!Thereareonly the printof "printserverA"are deleted.I would also havea list ofDNS namesthat areaffected.Thereare123units.

With this code it deletes all printers. I do not want yes.

Remove-Item -Path 'hklm:\system\currentControlSet\Control\Print\Environments\Windows x64\Drivers\Version-3\*'
get-wmiobject -class win32_printerDriver -Filter "Name LIKE '*'" | ForEach-Object{$_.Delete()}


Can you please help me? Thx

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles