3

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

1
  • Were they added as global or local printers originally?
    – Colyn1337
    Apr 30, 2014 at 16:57

2 Answers 2

1

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

2
  • 1
    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
    Aug 7, 2012 at 21:20
  • 1
    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/02/…)
    – bonedog73
    Aug 7, 2012 at 21:26
0

This is the one I used in the past (VBsript):

'----------------------------------------------------
'Remove all Network printers but not local printers
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set Printers = WshNetwork.EnumPrinterConnections

For i = 0 to Printers.Count - 1 Step 2

    If Left(ucase(Printers.Item(i+1)),2) = "\\" Then
        WScript.Echo Printers.Item(i+1)
        WSHNetwork.RemovePrinterConnection Printers.Item(i+1)
    End IF
Next

Hope it helps!

1
  • 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
    Aug 7, 2012 at 14:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .