No announcement yet.

Removing Printers with PRINTUI.DLL

  • Filter
  • Time
  • Show
Clear All
new posts

  • Removing Printers with PRINTUI.DLL

    Removing Printers with PRINTUI.DLL

    I'm having a few issues trying to remove a printer with the PRINTUI.DLL command. I was asked to restrict access to a printer so I need to remove the printer form a few users accounts.
    The printer its self is hosted on a Win 2003 Server and each time we have given users access in the past it's been a case of browsing to the printer on the server, right clicking & choosing connect. This would then install the printer & download the printer driver locally to the XP computer.
    The printer is shared as "2250n_colour" and its installed on server "sh-dmc1" to the full path would be:


    Im using the following script to remove the printer from a test machine:
    rundll32 printui.dll,PrintUIEntry /gd /c\\test-laptop /n\\test-laptop\2250n_colour

    The error I see is "Unable to delete the per machine printer connection. Operation could not be completed.

    Im running the command from dos on my PC, I have domain Admin rights
    Any suggestions why this isn't working?

    It might be worth noting Ive been following the examples on this site:

  • #2
    Re: Removing Printers with PRINTUI.DLL

    This is weird, if I run:

    rundll32 printui.dll, PrintUIEntry /ge /c\\test-laptop

    It displays a box which says "Per Machine Printer Connections" but this is empty??

    So I guess the printer I have installed isnít a per machine printer which is why the script doesnít work.

    Any ideas how to remove the printer?


    • #3
      Re: Removing Printers with PRINTUI.DLL

      There is a .vbs script that is alreay built into windows XP and 7 I know of for sure. I have used it before to remove printers that were installed using the IP address as a local printer. It is located in c:\windows\system32\prnmngr.vbs. I just wrote a simple batch file and run it that way. I hope this helps you out.

      cscript c:\windows\system32\prnmngr.vbs -d -p "Printer Name"


      • #4
        Re: Removing Printers with PRINTUI.DLL

        What happens if you try running your script/cmdlet using the identity of a user who has mapped the printer?

        I always thought printer mappings were done on a per-user basis.. ?
        Please do show your appreciation to those who assist you by leaving Rep Point


        • #5
          Re: Removing Printers with PRINTUI.DLL

          True, is a user mapping, kept in your user hive.

          And you dont need admin rights to delete a "connected" printer. Unlike the printer itself.
          Please give points where appropriate

          <I dont create ready scripts for you, but I'm willing to point you in the right direction>