Novell is now a part of Micro Focus

Prepping NETBios CNames in Domains for ZENworks

Novell Cool Solutions: Feature
By Sterling Smith

Digg This - Slashdot This

Posted: 11 Jul 2002

A common solution I've been asked to solve during ZENworks for Desktops implementations is cleaning up the Netbios Windows computer names that almost always end up as the basis for the eDirectory workstation name.

Until recently, I've used ENGL's Zcnc to rename workstations to the serial number as discovered through WMI. This works great until a workstation is a member of a domain--at which time the domain trust relationship breaks.

There's another utility on Cool Solutions called WSName (written by a former Novell Consultant) which will handle this--and even rename the workstation in the domain (the catch is that you must pass a domain account user/pass) on Win2k and up. The catch to this is that WSName doesn't support reading WMI to get the computer name. But that is easily solved.


1. New images (W2k) deployed must automatically add the workstation to the domain.

2. New images (W2k) deployed must automatically rename the computername to the WMI serial tag. Customers would like the option of using the asset tag if populated.


Use Sysprep 1.1. To automatically and temporarily name the computer, use the following in the sysprep.inf:


To have the mini setup process automatically join the computer in the domain, use the following in the sysprep.inf:


Athough a generated name gets initially generated at the time sysprep is executed, we rename the workstation on the following boot by running a vbscript that will read the contents from WMI and run WSName with the appropriate parameters.

First, we place the following in the sysprep.inf:

    Command0="cscript %systemroot%\system32\cpurename.vbs"

Then, we copy wsname.exe and the following script into %systemroot%\system32:

If you want to extract the WMI serial tag, use the following code snippet as cpurename.vbs:

Set objWMI = GetObject("WinMgmts:")
Set objs = objWMI.InstancesOf("Win32_Bios")
For Each obj In objs
   strSN = strSN & obj.SerialNumber
strSN = Trim(strSN)

Set objWS = CreateObject("WScript.Shell")
strRun = "WSName /N:" & strSN & " /RCID /USER: /PASS:
/UNREG" strRun

If you want to use the asset tag, use the following:

Set objWMI = GetObject("WinMgmts:")
Set objs = objWMI.InstancesOf("Win32_SystemEnclosure")
For Each obj In objs
   strAT = strAT & obj.SYMBIOSAssetTag
strAT = Trim(strAT)

Set objWS = CreateObject("WScript.Shell")
strRun = "WSName /N:" & strAT & " /RCID /USER: /PASS:
/UNREG" strRun

Note that <user> and <pass> are replaced with the appropriate values.

Comment: I think learning VBScript is a great value-add when combined with ZENworks. Upgrading it to the latest version (5.6) is critical in eliminating the infamous security issues taken advantage of with latest virus strains.

I also make sure that all NAL files are local and NAL runs, so as to install any add-on images during the process. I also "autologin" the first time by placing the following in sysprep.inf:


Finally I remove the autologin process by running a registry hack change that is executed. The following is saved as wrapup.reg

Windows Registry Editor Version 5.00


Finally, this is called from sysprep.inf with:

    Command1="regedit /s c:\wrapup.reg"

Hopefully, this solution will help other engineers and consultants some time on their next imaging assignment.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates