I previously had a script that would run at startup and delete all Brother PocketJet printer copies using the following command:
WMIC Printer where "Name LIKE 'Brother *(Copy *'" Delete
Recently this command has stopped detecting the printers after they have been disconnected (these are local printers that are connected directly to the computer). I have tried the following command which also does not detect the disconnected printers:
Get-WmiObject -class Win32_Printer | where{$_.name -like 'Brother PJ-723 (Copy%'} | foreach{$_.delete()}
If I run Get-Printer I get the following output which excludes the 14+ copies I have of the Brother PocketJet printers which can be seen in this screenshot
PS> Get-Printer
Name ComputerName Type DriverName PortName Shared Publishe
d
---- ------------ ---- ---------- -------- ------ --------
OneNote for Windows 10 Local Microsoft Software Pri... Microsoft.Of... False False
OneNote (Desktop) Local Send to Microsoft OneN... nul: False False
Microsoft XPS Document Writer Local Microsoft XPS Document... PORTPROMPT: False False
Microsoft Print to PDF Local Microsoft Print To PDF PORTPROMPT: False False
Fax Local Microsoft Shared Fax D... SHRFAX: False False
Adobe PDF Local Adobe PDF Converter Documents*.pdf False False
Anyone have any other ideas on how I can detect and delete these printer copies that are in the “Not Connected” state?