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