+ Post New Thread
Results 1 to 7 of 7
Windows 7 Thread, CON2PRT Problems in Technical; Hi folks, I've inherited a domain that uses the CON2PRT routine with a long script and an environment variable to ...
  1. #1
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    826
    Thank Post
    721
    Thanked 14 Times in 13 Posts
    Rep Power
    9

    Question CON2PRT Problems

    Hi folks,

    I've inherited a domain that uses the CON2PRT routine with a long script and an environment variable to define which PCs connect to what printer (we have a lot of classrooms and printers). Example below:

    \\dc\NETLOGON\CON2PRT /F (disconnects all printers)

    IF %Location% == ROOM1 \\dc\NETLOGON\CON2PRT /CD \\prtsrv\room1printer

    It's an elegant system and until a few weeks ago this was working without issue, but now we're getting up to a third of students with no printers mapping at all. Typically if they switch PCs it works, and they can return to the same PC after switching and then it works.

    Anyone use this routine and have any idea what could be causing this?

    The only change to the PCs that I can think of would be Windows Updates. The only workaround I can think of is hard mapping each PC to the printers in the room, and disabling the script.

    TIA

  2. #2
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    41
    Sorry been years since I used con2prt.. didn't know it was still being used to be honest but you could vbscript it:

    Code:
    on error resume next
    Set shell= WScript.CreateObject("WScript.Shell")
    Set WshNetwork = WScript.CreateObject("WScript.Network")
    dim Counter, PrinterPath
    dim strResult, strLocation
    
    'Remove All Network Printers.
    'Commented out because users use mandatory profiles, if this changes add this back in.
    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
    
    'Get the Location and Computer Name from Environment Variables.
    
    strLocation = shell.ExpandEnvironmentStrings("%LOCATION%")
    
    
    'Add Network Printers based on Location set in Environment Variables
    
    select case strLocation
    	case "ROOM1"
    		addPrinter "\\prtsrv\room1printer",true
    		addPrinter "\\prtsrv\room1printer2",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
    Last edited by apeo; 7th December 2012 at 10:27 AM.

  3. Thanks to apeo from:

    Gongalong (7th December 2012)

  4. #3
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    826
    Thank Post
    721
    Thanked 14 Times in 13 Posts
    Rep Power
    9
    My head certainly hurts now I'll give it a go though, when the opportunity presents itself.

  5. #4

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,228
    Thank Post
    2,773
    Thanked 937 Times in 877 Posts
    Rep Power
    343
    Group Policy Preferences if your server OS is up to date enough and can do GPP ?

    Change the drop down menu from update to create ( as you are creating a new printer as apposed to updating an existing or already added / installed printer that you are pushing out )

    http://abskb.wordpress.com/2009/07/3...ng-profiles-2/

    OR

    http://www.grouppolicy.biz/2011/01/faq-2-how-do-you-map-printer-using-group-policy-preferences/


    Last edited by mac_shinobi; 7th December 2012 at 12:35 PM.

  6. Thanks to mac_shinobi from:

    Gongalong (7th December 2012)

  7. #5
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    826
    Thank Post
    721
    Thanked 14 Times in 13 Posts
    Rep Power
    9
    Would this work where the student location changes all the time? i.e. they only get printers relevant for the room they're in.

  8. #6

    mac_shinobi's Avatar
    Join Date
    Aug 2005
    Posts
    9,228
    Thank Post
    2,773
    Thanked 937 Times in 877 Posts
    Rep Power
    343
    under the common tab there should be targeting options with regards to how the GPP's are targeted or who or where they are applied :

    Target Group Policy Preferences by Container, not by Group - Ask the Directory Services Team - Site Home - TechNet Blogs

    More specific :

    Christjan's IT Minutes Sample scenarios of dynamic printer deployment with Group Policy Preferences

  9. Thanks to mac_shinobi from:

    Gongalong (10th December 2012)

  10. #7
    Gongalong's Avatar
    Join Date
    Oct 2011
    Location
    United Kingdom
    Posts
    826
    Thank Post
    721
    Thanked 14 Times in 13 Posts
    Rep Power
    9
    Thanks.

SHARE:
+ Post New Thread

Similar Threads

  1. Intermitent problems with logging on
    By alexknight in forum Wireless Networks
    Replies: 27
    Last Post: 22nd August 2005, 04:01 AM
  2. Problem accessing machines from a sub-domain
    By mark in forum Wireless Networks
    Replies: 13
    Last Post: 22nd August 2005, 03:52 AM
  3. Problems with Google Earth
    By Dos_Box in forum Educational Software
    Replies: 8
    Last Post: 19th August 2005, 02:32 PM
  4. Replies: 2
    Last Post: 19th August 2005, 07:49 AM

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
  •