Removing printer with a login script

Hi,

I would like to know if it is possible to delete a local printer on Windows XP with a login script.

I know it is possible to delete a network printer with this VBscript

Dim net
Set net = CreateObject("WScript.Network")
net.RemovePrinterConnection "\\bonemine\020-labo-01"

But what about local printers???

Thanks,

Yan Bergeron
Montréal
yanbergeron24Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jimbobmcgeeCommented:
Try:

    net.RemovePrinterConnection ".\printername"

or maybe:

    net.RemovePrinterConnection "\\" & net.ComputerName & "\printername"

J.
0
yanbergeron24Author Commented:
Hi,

net.RemovePrinterConnection ".\HP 2000C"
      doesn't work. Error (this connection doesn't exist)

net.RemovePrinterConnection "\\" & net.ComputerName & "\HP 2000C"
      doesn't work. Error (this connection doesn't exist)

More idea?
0
vinnyd79Commented:
Here is an example that uses Prnadmin.dll from the resource kit:

http://thelazyadmin.com/index.php?/archives/159-Manage-Printers-With-VBS,-WMI-and-Prnadmin.dll.html
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DeadlyTrevCommented:
yanbergeron24,

Not sure about this, but ......
When you use net.RemovePrinterConnection, don't worry about the machine name qualifier if its a local printer.
Try    net.RemovePrinterConnection "020-labo-01"

Alternatively :-)   The command below will install a printer instance.  I'm sure there's something similiar to remove one.

    Shell ("rundll32 printui.dll,PrintUIEntry /if /u /b " & Chr$(34) & FullPrinterDriverName & Chr$(34) & " /m " & Chr$(34) & FullPrinterDriverName & Chr$(34) & " /f " & Chr$(34) & PrinterDriverINF & Chr$(34) & " /r " & Chr$(34) & PrinterPort & Chr$(34))
0
HTorresCommented:
delete them from registry with visual basic

HK current user / printers
search for the printer, and delete the key.

you can make an exe and put it in to the login script

also, maybe you are tired of xp automatic printer discovery, on explorer select TOOLS / OPTIONS
[ VIEW ]
[_] search for network printer / folders (something like that, i dont have an xp english version near)

hope this helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HTorresCommented:
thanks yanbergeron24

note that this procedure will left drivers and everything still on the disk.  wich can be cluttering if this is one of those printers that need special apps to make it work.

:(

but if it is some "xp detected and automatically installed printer" i think there is no big trouble.

Thanks again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.