Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding/removing printers via prnmngr.vbs

Status
Not open for further replies.

EM64T

IS-IT--Management
Jan 20, 2003
37
US
I'm working with XP clients over a Windows 2003 domain, and I would like each client to have all their printers wiped then certain printers I choose to be installed upon logon.

So far my script consists of this to remove the printers:

cscript c:\windows\system32\prnmngr.vbs -x

and this to add the printers:

cscripts c:\windows\system32\prnmngr.vbs -ac -p "\\Calvin\Primary Lab Laser"

While according to the XP documentation on Microsoft's site this should work, I get the following error:

Unable to enumarate printers Error 0x80041001 Generic failure

I'm not really sure what the error means, I even looked it up on Google and nothing pertained to prnmngr.vbs. I also tried adding the -u -w switches to the remove printers string with the correct administration account information, but that didn't seem to have any effect.

Any ideas? I'm new to scripting across the network and hoping I can save myself some hassle with creating printers available to all users and wiping anything that shouldn't be in there.
 
I might be able to hack that script up, my only problem being with:

'Remove an old printer
WSHNetwork.RemoveWindowsPrinterConnection "\\ServerOld\HP5si"


I need it to (in effect) remove *all* printers that are currently installed. Each computer can be different, and I would prefer to just insert a wildcard in there to remove everything. Not sure how to go about that in VBscript..

Just a guess (I'm not into vbs scripts), are the users still using their printers and printing at the time you are running this script?


Well, I ran my test under my own personal account, and I wasn't using any printers so that rules it out. :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top