Tom E. Pinkerton wrote:
> Friends,
>
> My issue, in brief: I need to find a way to create the proper printer
> connection and set it as the default printer based upon where the user
> is logging on.
>
> Our setup: We have a single server running Windows Server 2003
> Standard. We have one main computer lab, in which all computers share
> an HP Business Inkjet 1100d printer. We have a library and a few
> classrooms in which several computers share one printer, and in each
> additional classroom there is one computer with a single printer that
> is physically connected to the computer. Most computers are assigned
> dynamic IP addresses through DHCP.
>
> Currently, we are not using any sort of login script at all, so I am
> willing to consider any login scripting language/processor that will
> suit the task.
Hi
To do this, you need a logon script.
I would think that each room does not have it's own IP range,
so then you have two ways to handle the location issue.
Three options below (all code below is in VBScript) + some links
to some more general logon script info below that again:
************************************************** ********
1)
In AD, create an OU for each room, and put the different computer
objects into the OU that represents the room for the computer.
In the user logon script, you can then pick up the location based on
the OU the computer is placed in:
'--------------------8<----------------------
Set oADSystemInfo = CreateObject("ADSystemInfo")
Wscript.Echo "Computer's distinguished name: " & oADSystemInfo.ComputerName
' get computer object from AD for current computer
Set oComputer = GetObject("LDAP://" & oADSystemInfo.ComputerName)
Wscript.Echo "Computer object's parent path: " & oComputer.Parent
'--------------------8<----------------------
2)
To avoid messing with the OU structure, you could just put the location
of the computer into the description field of the AD computer object.
In the user logon script, you can then pick up the location based on
the computer description:
'--------------------8<----------------------
Set oADSystemInfo = CreateObject("ADSystemInfo")
' get computer object from AD for current computer
Set oComputer = GetObject("LDAP://" & oADSystemInfo.ComputerName)
Wscript.Echo "Computer's description: " & oComputer.Description
'--------------------8<----------------------
3)
If you can't/don't want to do anything with the computer objects in AD:
Create a registry value or a file on each computer indicating the room
placement, and let the logon script test on this.
************************************************** ********
For some more VBScript examples, take a look under "Group Membership
Tests" and "Logon Scripts" under "Free VBScript Code" at
http://www.rlmueller.net/
You will also find logon script examples with group testing etc. at
http://cwashington.netreach.net as well.
E.g. here:
http://cwashington.netreach.net/depo...e=LogonScripts
Some more general logon script links:
Frequently Asked Questions about Logon Scripts
http://www.rlmueller.net/LogonScriptFAQ.htm
Logon Script info at LabMice.net
http://labmice.techtarget.com/script...gonscripts.htm
Enterprise Logon Scripts
http://www.microsoft.com/downloads/d...displaylang=en
--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scr...r/default.mspx