Control Panel>Devices and Printers object locations?
-
So I'm learning to code powershell and I'm playing around with writing my own script to target and delete network xerox printers and printer drivers from a machine locally. I'm having issues where when I run the following scripts:
PS C:\Windows\System32> Get-Printer | where{$_.Name -like "*Xerox*"} | Remove-Printer
&
PS C:\Windows\System32> Get-PrinterDriver | where{$_.Name -like "*Xerox*"} | Remove-PrinterDriver
The scripts work, as Get-Printer, Get-PrinterDriver verify that they no longer exist, but they still show up greyed-out in Control Panel>Devices and Printers. (rebooting machine doesn't make them go away either).
A bit of trial and error to be sure I couldn't figure it out before I asked you all was to additionally delete any match to "Xerox" in registry, and a complete removal of all files in the following directories:
C:\Windows\System32\Spool\Servers\*
C:\Windows\System32\Spool\Drivers\x64\*
C:\Windows\System32\Spool\Printers\*
C:\Windows\System32\DriverStore\FileRepository\*Xerox*
I'm obviously looking for a way to streamline this process, so without opening Control Panel via GUI, and manually deleting them, I'd like to do it with script. This isn't a request for a script however, but a request for information regarding the location of these objects, or any experience in regards to deleting them.
-
@mr-jones this is what I use.
It is not 100% but I have never noticed a left over printer.
https://mangolassi.it/post/413461 -
https://mangolassi.it/post/413461
Oh look, G I Jones, I remember that guy.
Anyway, this is adding a network printer... I don't think this helps at all to be honest. Did you misread the post? Am I missing something?
-
@mr-jones said in Control Panel>Devices and Printers object locations?:
https://mangolassi.it/post/413461
Oh look, G I Jones, I remember that guy.
Anyway, this is adding a network printer... I don't think this helps at all to be honest. Did you misread the post? Am I missing something?
it does have one line that removes a port
Remove-PrinterPort -name $PrinterPort