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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbs mapping a printer - "local device name already in use" error

Status
Not open for further replies.

sman26

Vendor
Jan 13, 2005
36
US
I am mapping an HP Laser Jet printer using vbs and group policies.

Here it is:
Set objNetwork = CreateObject("WScript.Network")
UserString = objNetwork.UserName

objNetwork.MapNetworkDrive "Z:" , "\\capitolserver\" & UserString,True
objNetwork.AddWindowsPrinterConnection "\\capitolserver\ISHPC3700"

When I log on the first time with the script works great with no errors so the script it correct. However the second time I log in I get the "The Local Device Name is Already In Use" and the error points to the vbs line referring to the printer mapping. I even tried to delete the printer and try again I get the error that it is in use. Do I need to write a DISCONNECT PRINTER script to take the printer off of the PC everytime so that the error won't occur. I have never seen anyone else have to do this but maybe people do?

Thanks for any help.
Shawn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top