Unable to remove network printers via script in Windows 7

5,696

Okay, let's try this then:

1st) you'll have to stop the print spooler first:

start -> run -> cmd
type in: net stop spooler

2nd) follow this link to uninstall the printer

3rd) restart the print spooler

start -> run -> cmd
type in: net start spooler

Now, hopefully this will help your issue

Share:
5,696

Related videos on Youtube

bonedog73
Author by

bonedog73

Updated on September 18, 2022

Comments

  • bonedog73
    bonedog73 almost 2 years

    I've tried removing several network printers via rundll32 printui.dll, PrintUIEntry /dn /dd /q /n \\SERVER\PRINTER also tried the /dl but nada

    and

    WSHNetwork.RemovePrinterConnection "\\\Server\Printer",True,True

    I've ran the scripts remotely and locally on different user profiles and the scripts appear to run without error but the printers never get removed, they're still there!

    If the user right clicks on the printer they can remove it by clicking Remove Device.

    Wondering if anyone else has seen this issue in Windows 7. Only thing I can think of is that it's a UAC issue..

    • Colyn1337
      Colyn1337 about 10 years
      Were they added as global or local printers originally?
  • bonedog73
    bonedog73 almost 12 years
    Unfortunately it didnt work, printers still there :( - script shows it ran successfully but... I'm using admin account to run the script and it doesnt work but a regular user account can right click the printer and Remove Device without issue. It's like the scripts are just ignored.... So weird only have this issue in Win7, XP works great without issue.
  • bonedog73
    bonedog73 almost 12 years
    Ok I'm a bit of a dork....I was running the script on the local machine instead of putting in logon scripts....d'oh! After adding the script to the logon script for the affected machines it worked great! Thanks for your help! :)
  • bonedog73
    bonedog73 almost 12 years
    This is the script I ended up using in logon scripts - not sure how to use this comment system everytime I hit enter it hits the save button so....(blogs.technet.com/b/heyscriptingguy/archive/2007/11/0‌​2/…)