Share via


How to remove a printer via powershell added via RUNDLL32 PRINTUI.DLL?

Question

Friday, January 25, 2019 4:37 PM

A while ago I added some printers via cmd with this command:

RUNDLL32 PRINTUI.DLL,PrintUIEntry /ga /z /n\server\Printer

This add a printer to computer instead of to user. When a new user logs on in the computer the printers added with RUNDLL32 PRINTUI.DLL are installed and if I remove the printers via powershell, in the next boot the printers returns.

I need of a powershell script to remove those printers added per computer, you know a way to do it???

All replies (6)

Friday, January 25, 2019 9:55 PM âś…Answered | 1 vote

I would think "/gd" instead of "/ga":

RUNDLL32 PRINTUI.DLL,PrintUIEntry /gd /z /n\server\Printer


Friday, January 25, 2019 7:36 PM

Hi rafaeljsc.

You can use the Get-Printer cmdlet to retrieve a list of all the installed printers and the Remove-Printer cmdlet to remove a printer from a specified computer: take a read at the blog post at https://blogs.technet.microsoft.com/heyscriptingguy/2013/08/08/use-powershell-in-windows-8-to-remove-printers/.

Bye.

Luigi Bruno
MCP, MOS, MTA, MCTS, MCSA, MCSE


Monday, January 28, 2019 7:37 AM

Hi,

Was your issue resolved?

If you resolved it using our solution, please "mark it as answer" to help other community members find the helpful reply quickly.

If you resolve it using your own solution, please share your experience and solution here. It will be very beneficial for other community members who have similar questions.

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

Best Regards,

Lee

Just do it.


Tuesday, February 5, 2019 7:32 PM

This command removes the printer, but it back in the next login :(


Tuesday, February 5, 2019 7:35 PM

The Client Side Rendering print provider, or "CSR" in the Event Viewer, introduced in Vista can overfill the registry.  It's possible for unwanted printers to continue to load from the registry.  See Seannoy2's response here:  [https://community.spiceworks.com/topic/1932797-use-powershell-to-delete-a-mapped-printer

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

WS2008:  Client-Side Rendering:  https://blogs.technet.microsoft.com/askperf/2008/02/10/ws2008-client-side-rendering/


Tuesday, February 5, 2019 7:37 PM

Yes, this is the correct command to removes a printer added with "/ga" switch, but I have a powershell's script and I need/want write all script in powershell, but I not found a similar "/gd" parameter to do it with powershell... I think that I'll hack this powershell script with this comand and solve it soon, Thanks.