I am currently using Con2Prt to connect the users to the dedicated printer in their IT room. But the problem i am having is that sometimes if the user goes into a different IT room it will pick up the previous printer from the previous room.
Is there a solution to this or an alternative method or program i can use like VBS but i am new to VBS and it all all confuses me.
Currently the con2prt file checks the room in the autoexec.bat and then using the batch file connects to the dedicated printer. But sometimes as i say it still connects to the previous printer that was used.
Can anyone please help
An extract from ours is:
on error resume next
Set shell= WScript.CreateObject("WScript.Shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
dim Counter, PrinterPath
dim strResult, strLocation, strComputer
'Remove All Network Printers.
Set oPrinters = WshNetwork.EnumPrinterConnections
FOR Counter = 0 to oPrinters.Count - 1
IF mid(oPrinters.Item(Counter), 1, 2) = "\\" THEN
PrinterPath = oPrinters.Item(Counter)
WshNetwork.RemovePrinterConnection PrinterPath, True, True
'Add Network Printers based on Location set in Environment Variables
strLocation = shell.ExpandEnvironmentStrings("%LOCATION%")
strComputer = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
select case strLocation
if strConnectString <> "" then
strResult = WshNetwork.AddWindowsPrinterConnection(strConnectString)
if isDefault then
In your script do you remove all previous network printers ie
As for the rest of your question check the following thread out.
To the ist reply does that code contain deleting any printers currently installed?
To the 2nd reply yes in the script it does say remove all current printer connections
If that is the case then there is a problem at startup i imagine as its not doing what its supposed to be doing. As for the script that is posted, the answer to your question is No, it is the script version of con2prt and it removes all network printers then adds in the ones you want based on location. However the script can be tweaked to remove specific printers.
Do you have the tweaks that could be used?
I'll post it up when i get some time.
put con2prt /? in the command prompt this will give you a list of things it's able to do!
i had this problem at 1 of my schools i simply put
at the top of my script before it did anything else and it seemed to cure the problem!
Thanks alot krisd32 i will try it.