+ Post New Thread
Results 1 to 10 of 10
Networks Thread, Con2Prt in Technical; Hi All, I am currently using Con2Prt to connect the users to the dedicated printer in their IT room. But ...
  1. #1

    Join Date
    Dec 2005
    Posts
    449
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Con2Prt

    Hi All,

    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

    Steve

  2. IDG Tech News

  3. #2
    alan-d's Avatar
    Join Date
    Aug 2005
    Location
    Sutton Coldfield
    Posts
    2,272
    Thank Post
    296
    Thanked 203 Times in 151 Posts
    Rep Power
    62

    Re: Con2Prt

    An extract from ours is:

    Code:
    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
    	End If
    Next
    
    'Add Network Printers based on Location set in Environment Variables
    
    strLocation = shell.ExpandEnvironmentStrings("%LOCATION%")
    strComputer = shell.ExpandEnvironmentStrings("%COMPUTERNAME%")
    
    select case strLocation
    	case "ASTLaptop"
    		 addPrinter "\\server2\hplassta",true
    	case "ITOffice"
    		addPrinter "\\server2\HP4100IT",true
    		addPrinter "\\server2\copyroom1232",false
    		addPrinter "\\server2\ILCStudent",false
    
    		
    end select
    
    function addPrinter(strConnectString,isDefault)
    
    		if strConnectString <> "" then
    				strResult = WshNetwork.AddWindowsPrinterConnection(strConnectString)
    			if isDefault then
    				WshNetwork.SetDefaultPrinter strConnectString
    			end if
    		end if
    end function

  4. #3
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,430
    Thank Post
    79
    Thanked 90 Times in 86 Posts
    Rep Power
    32

    Re: Con2Prt

    In your script do you remove all previous network printers ie

    \\SERVER1\APPLIC\CON2PRT\CON2PRT /F

    As for the rest of your question check the following thread out.

    Previous thread

  5. #4

    Join Date
    Dec 2005
    Posts
    449
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Con2Prt

    To the ist reply does that code contain deleting any printers currently installed?

  6. #5

    Join Date
    Dec 2005
    Posts
    449
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Con2Prt

    To the 2nd reply yes in the script it does say remove all current printer connections

  7. #6
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,430
    Thank Post
    79
    Thanked 90 Times in 86 Posts
    Rep Power
    32

    Re: Con2Prt

    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.

  8. #7

    Join Date
    Dec 2005
    Posts
    449
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Con2Prt

    Hi,

    Do you have the tweaks that could be used?

  9. #8
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,430
    Thank Post
    79
    Thanked 90 Times in 86 Posts
    Rep Power
    32

    Re: Con2Prt

    I'll post it up when i get some time.

  10. #9
    krisd32's Avatar
    Join Date
    Feb 2006
    Location
    Longridge, Preston
    Posts
    527
    Thank Post
    82
    Thanked 63 Times in 42 Posts
    Rep Power
    28

    Re: Con2Prt

    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
    \\SERVER1\APPLIC\CON2PRT\CON2PRT /F

    at the top of my script before it did anything else and it seemed to cure the problem!

  11. #10

    Join Date
    Dec 2005
    Posts
    449
    Thank Post
    4
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Re: Con2Prt

    Thanks alot krisd32 i will try it.

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 4
    Last Post: 19th April 2007, 09:22 AM
  2. Con2Prt
    By faza in forum Scripts
    Replies: 2
    Last Post: 26th January 2007, 01:45 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •