Novell is now a part of Micro Focus

Workstation Name Changer

Novell Cool Solutions: Trench
By David Clarke

Digg This - Slashdot This

Posted: 3 Jan 2002

Updated 3 Jan 2002
Current version: ZENworks for Desktops 3

WSName was first sent to ZENworks Cool Solutions as an addition to the article on Naming the Computer After the Login Name. It has gone through several revisions since then, and here is the latest, greatest incarnation, from cool New Zealander David Clarke. Thanks, David!


Command Line Switches

/H /?
Opens this document

Checks the "Unregister Workstation" function (if UNREG32.EXE is in the path)

/PG:<Name to Check>
Post Ghost mode, see below for more details on Post Ghost

Name Sync mode, sets the host name to the computer name, no dialogue is shown

/N:<new name>
Silent Operation, updates computer name without intervention, no dialogue is shown

Reboot on completion, only effective when using /NS or /N (reboots only if name is changed)

Suppresses reboot prompt in GUI mode

Uses Reverse DNS lookup to determine Workstation's new name, see below for more details for reverse lookup mode

Uses the MAC Address for the primary Ethernet Adapter as the Computer Name

Adds a prefix to the MAC address for those old DNSs that don't like all numeric host names, max length 3 characters (only effective with /MAC)


WSName writes a log of what it is doing in the temp directory (wsname.log). This log is mostly complete but I haven't yet got around ensuring its completeness.

Post Ghost Mode

Post Ghost mode checks the name of the computer against the name passed with the /PG switch. If the names match, the standard dialog is shown, otherwise the program terminates.

As workstations built via Ghost (or similar cloning tool) will have the same name, the idea was to call WSName via a login script or Novell Application Launcher (NAL) force run to remind the workstation builder to set the workstation's name correctly.

Reverse DNS Lookup

This mode of operation performs a reverse DNS lookup against the primary DNS server to determine the workstation's name. This may be handy for those installations using static IP address assignments, but should work OK with dynamic DNS sites too.

I haven't tested this extensively (much), but feedback to date suggests that it works OK.

How WSName works

Windows 9x and Windows NT 4.0

The workstation name is read using the "GetComputerName" API call, and set using the "SetComputerName" API call. Sadly both of these functions only concern themselves with the NetBIOS name, so the TCPIP name (hostname) needs to be manipulated separately, I can't find an API that does this (and if you know of one please let me know) so WSName writes directly to the registry, the keys that hold this information differ between Windows NT and Windows 9x.

  • Windows NT: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\
  • Windows 9x: HKLM\SYSTEM\CurrentControlSet\Services\VxD\MSTCP\

Windows 2000 Professional

The process for Windows 2000 is pretty much the same, however I'll utilise the new APIs some time soon:

  • SetComputerNameEx(ComputerNamePhysicalNetBIOS, Name)
  • SetComputerNameEx(ComputerNamePhysicalDnsHostname, Name)

The workstation needs to be rebooted for the change to take effect.

Running UNREG32.EXE

During the program load, the SearchPath API call is used to search for UNREG32.EXE. If it is found then the "Unregister Workstation" tick box is enabled.

UNREG32.EXE removes the registry information about the workstation registration from HKLM\SOFTWARE\NOVELL\ WORKSTATION MANAGER\IDENTIFICATION. It does not remove any objects from Novell Directory Services (NDS).

UNREG32 is a component of Novell's ZENworks for Desktops.

The Workstation Name

WSName examines the new workstation name for validity based on the following:

Microsoft Support Document Q188997 details that valid NetBIOS computer names can be up to 15 alphanumeric characters with no blank spaces. The name must be unique on the network and can contain the following special characters:

! @ # $ % ^ & ( ) - _ ' { } . ~

The following characters are not allowed:

\ * + = | : ; " ? < > ,

Microsoft Support Document Q244739 suggests that it's not a good idea to start a computer name with a hyphen (-).

Host names have slightly looser naming rules but since we want computer and host names to be the same, WSName uses the most restrictive.

Modification History

  • Ver 2.32: Added the /PRE option after having a think about all those old DNS servers
  • Ver 2.31:
    Added /MAC option for Michael Horskey
  • Ver 2.3:
    • Added /DNS option for Mikko Makela
    • Added: /NOREBOOT option for Tim Manley
    • Moved logging from the registry into a text-based log file in the temporary directory (logging still not complete)
    • Corrected a bug in resolving HostName under W2K (other OS's OK)
  • Ver 2.2:
    • Added /NS (Name Sync) option
    • Added /N (New Name) option
    • Added /REBOOT option
    • Added check for Admin rights under Windows NT and 2000

Known Limitations

No known problems with this build. Still need to complete the logging.

Other Stuff

WSName can be called from within NetWare login scripts. But remember if you want to use login script variables, some are case sensitive (%LOGIN_NAME is OK but %login_name doesn't return the login name).

eg: #z:\wsname /N:%LOGIN_NAME

WSName is written in Borland Delphi version 4. This has the advantage of not requiring any additional DLL's to run, but the penalty is the relatively large executable size (around 390k). Most of this is the Delphi forms unit (around 250k I think).

The Reverse DNS lookup function uses the fantastic WSocket component from Fran?ois Piette available at (Note: This is a new url as of 3 Jan 2002)


This software is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.



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

© Copyright Micro Focus or one of its affiliates