Removing Printers with PRINTUI.DLL

Home Forums Scripting General Scripting Removing Printers with PRINTUI.DLL

This topic contains 4 replies, has 4 voices, and was last updated by Avatar K.S.Powar 8 years, 5 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • Avatar
    Deland01
    Participant
    #154311

    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:

    [URL=”file://\sh-dmc12550n_colour”]\sh-dmc12550n_colour[/URL]

    Im using the following script to remove the printer from a test machine:
    rundll32 printui.dll,PrintUIEntry /gd /c\test-laptop /n\test-laptop2250n_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:

    http://techsupt.winbatch.com/ts/T000001031F17.html

    Avatar
    Deland01
    Participant
    #293420

    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?

    Avatar
    K.S.Powar
    Member
    #381771

    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:windowssystem32prnmngr.vbs. I just wrote a simple batch file and run it that way. I hope this helps you out.

    cscript c:windowssystem32prnmngr.vbs -d -p “Printer Name”

    tehcamel
    tehcamel
    Moderator
    #357339

    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.. ?

    Avatar
    Silver23
    Member
    #292282

    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.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.