Facilitating Remote Control after User Changes Workstation Name
Novell Cool Solutions: Trench
By Bob Stumpp
Digg This -
Posted: 13 Nov 2002
Version: ZENworks for Desktops 3.2(Note: we inadvertently omitted an essential part of the login script when we posted this yesterday. Sorry. The version here is correct.)
A while back I read a Cool Solutions Tip from Xavier Zinn on Automatic Workstation Registration. His problem was with workstations moving from location to location. While my problem with our local government site was different Xavier's Cool Solutions Tip got me thinking of ways to use REGREAD.
Our local government site uses ZfD for application deployment and remote control. Application deployment has always worked well for us, but our problem was locating the workstation that we wanted to remote control. NIC cards change too often in laptops to use MAC addresses, IP number change as well, so we decided to use just the computer name. We thought that once set, no one would bother to change the computer name. Were we wrong! Our users apparently do not like our names, so everyone kept changing them. We name the computer one thing, the end user changes it to what they want, and then along comes another user and changes it again.
The NDS Workstation Object still has the first name, but how do we find it to be able to use Remote Control? REGREAD to the rescue. While it took some time and experimentation; I figured out how to use REGREAD and now the following has been added to all the container login scripts.
REGREAD "HKLM,SOFTWARE\NOVELL\WORKSTATION MANAGER\Identification,Workstation Object" TEMP SET REGNAME="%99" REGREAD "HKLM,SYSTEM\CurrentControlSet\Control\ ComputerName\ComputerName,ComputerName" TEMP SET CN="%99.WS.IMC" TEMP SET CN2="CN=%99.OU=WS.O=IMC" IF "%<REGNAME>" = "%<CN>" OR "%<REGNAME>" = "%<CN2>" THEN GOTO CONTINUE WRITE "Your Computer Name has changed; therefore, your workstation will be re-registered with NDS." #Z:\UNREG32.EXE #Z:\WSREG32.EXE CONTINUE:
Here is the line-by-line breakdown of what is happening:
Line 1: Reads the name of the Workstation Object
Line 2: Sets the name of the Workstation Object to "REGNAME"
Line 3: Reads the Computer Name of the workstation
Line 4: Sets "CN" to be the typeless distinguished name
Line 5: Sets "CN2" to be the typeful distinguished name
Line 6: Compares the Workstation Object Name "REGNAME" to the typeless and typeful distinguished names "CN" and "CN2". If there is a match, you then go to "CONTINUE" which is Line 10
Line 7: Writes out that the workstation will be re-registered with the NDS"
Line 8: Unregisters the workstation
Line 9: Registers the workstation
Line 10: Continue tag for the rest of the Login Script.
The automatic workstation removal process will remove the old workstation names in time, and our computer names match our NDS workstation object names.
REGREAD is a wonderful tool that can be used to solve many problems if used creatively. Have Fun!
If you have any questions you may contact Bob at BSTUMPP@indygov.org
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com