Gongalong Posted December 7, 2012 Posted December 7, 2012 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
apeo Posted December 7, 2012 Posted December 7, 2012 (edited) Sorry been years since I used con2prt.. didn't know it was still being used to be honest but you could vbscript it: 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 Edited December 7, 2012 by apeo 1
Gongalong Posted December 7, 2012 Author Posted December 7, 2012 My head certainly hurts now I'll give it a go though, when the opportunity presents itself.
mac_shinobi Posted December 7, 2012 Posted December 7, 2012 (edited) 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/31/how-to-use-group-policy-preference-to-dynamically-map-printers-when-using-roaming-profiles-2/ OR http://www.grouppolicy.biz/2011/01/faq-2-how-do-you-map-printer-using-group-policy-preferences/ Edited December 7, 2012 by mac_shinobi 1
Gongalong Posted December 7, 2012 Author Posted December 7, 2012 Would this work where the student location changes all the time? i.e. they only get printers relevant for the room they're in.
mac_shinobi Posted December 7, 2012 Posted December 7, 2012 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 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now