Share via


Deleting network printer with powershell on domain PC client

Question

Monday, December 23, 2019 7:54 PM

Hi there,

 I was able to install or delete a network printer for all users using the utility printui.exe so that whenever a user login on the computer, he or she has access to the printer. Now, I'd like to do the equivalent in powershell using Get-WMIObject -Class Win32_Printer and the Delete() method. However, the printer  is not deleted for all users and when I tried to restart the spooler, the printer reinstalls itself.

 I don't know if it counts for something(it probably does) but even when the printers are gone, there seems to be traces of them in the registries.

Anybody can help me with that?

thx.

All replies (6)

Tuesday, December 24, 2019 1:32 AM

Kindly go through the following Microsoft reference article:

Remove-Printer

S.Sengupta,Microsoft MVP Windows and Devices for IT, Windows Insider MVP


Tuesday, December 24, 2019 2:34 AM

Hi,

 

There is a way to clean up the registry of user printers, even after deleting their profile (deletes at logout and checks every 15 minutes):

 

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Providers\Client Side Rendering Print Provider]

"InactiveGuidPrinterAge"=dword:00000384

"ActiveGuidPrinterAge"=dword:00000384

"InactiveGuidPrinterTrim"=dword:00000384

"RemovePrintersAtLogoff"=dword:00000001

 

More information please refer to the following link:

https://community.spiceworks.com/topic/1932797-use-powershell-to-delete-a-mapped-printer

Note: This is a third-party link and we do not have any guarantees on this website. And Microsoft does not make any guarantees about the content.

 

Hope above information can help you.

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Thursday, December 26, 2019 5:58 AM

Hi,

 

Was your issue solved?

 

If the reply helped you, please remember to mark it as an answer.

 

If no, please reply and tell us the current situation in order to provide further help.

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].


Sunday, January 5, 2020 6:17 AM

Hi, I haven’t got a chance to test anything new yet. But will do soon. Thx.


Sunday, January 5, 2020 6:18 AM

Thx, Will test asap!


Tuesday, January 7, 2020 6:15 AM

Hi,

 

Thanks for your posting here!

If there is anything else we can do for you, please feel free to post in the forum.

 

Best Regards,

Farena

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].