#206943 - 2013-03-19 04:27 PM
Re: Efficiency Question - Adding Printers based on computer name
[Re: syntax53]
|
Glenn Barnas
KiX Supporter
   
Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
|
Our commercial logon script accomplishes something similar for several school environments by using a small, custom script add-on.
The idea is to uniquely identify the campus, building, and room. This can be done by any combination of AD Site, network subnet, Computer OU, or part of a workstation name. The last school system where this was deployed used AD Site for campus and the first 5 letters of the workstation name to ID the location by building and room. Our script uses value rewrite capabilities to dynamically replace all or part of a UNC path.
In this deployment, there were two tables in the INI file. One mapped the campus ID to a partial server name, and the second mapped the building/room to the remaining server name part and the printer name.
When the login script ran, the UNC path of &SITE:SITE-SERVER&&USER_PRT:PRINTER& is evaluated. The AD Site name is used to lookup a replacement value for the server. All servers have a consistent naming scheme, so a print server in the SITE NAME of Farnsworth would begin with "FWFPSP" (FarnsWorth FilePrintService Production). The table then replaces &SITE:SITE-SERVER& with "\\FWFPSP", the first part of a valid UNC path. There are often multiple print servers, so the identifier is not included yet.. this is only a partial server name.
The second macro is then replaced.. the "USER" part of the macro depends on some user-written code that takes the first 5 characters of the computer name. This provides the 2-character building and 3-digit room identification. This is looked up in the second table and replaced with the appropriate partial server name and printer name.
Imagine that the Farnsworth campus has 3 buildings - Fox (FX), Smyth (SY), and Williams (WM), and 3-digit rooms identify floor and room. Each building has a print server and each room has a printer. The printers are named for the location, something like PR-205 for the printer in room 205. The second macro would be replaced with "01\PR-205", so the complete UNC path for a printer in room 205 of the Fox building of the Farnsworth campus would be "\\FWFPSP01\PR-205". The computer name would have begun with "FX205" to identify the Fox building, room 205. The printer names don't have to identify the campus or building since the server name makes that clear. Of course, this can be adapted to any naming scheme.
This lookup and value replacement provides a lot of flexibility, needs only a single INI file, and is processed very quickly.
FYI - I've been maintaining and updating this login script for over 15 years now. One thing I'll tell you, especially with multiple locations, is that you want to minimize the size and number of INI files involved in the login process or performance can suffer dramatically. Our script can complete a complex array of mapping in just a few seconds, and our performance logs measure actions in ms.
Also, this script deals with printers using a "Default Eligible" concept. Each printer resource can be marked as "default eligible" or not. Using lookups, you can set this value based on many parameters, allowing selection of the most appropriate default printer. This selection can also be overridden with a local environment variable, useful when the instructor has a local printer (or printer in the teacher's lounge) for printing things that should not "accidentially" show up on the classroom printer.
---
Looking at your INI, you can't have "Printer2" listed multiple times. I'm assuming this is a copy/paste issue but want to be clear.
Glenn
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 388 anonymous users online.
|
|
|