wsname

 Workstation Name Changer

Name WSName.exe
Version 2.93
Date 9th April 2011
Author David Clarke
Function To provide an automated method to change a workstations name
Operating Systems Windows 9x, NT4, 2000, XP, 2003, Vista and Windows 7
Distribution Status Freeware, subject to disclaimer also see here
On the Web http://mystuff.clarke.co.nz
Contact Details email details can be found on the site here
Download Get it here

 Contents [Top]

What's new in this version?
Source
Command Line Switches
Logging
Renaming Remote Computers
Post Ghost Mode
Reverse DNS Lookup Mode
Using a Data File
How it Works
The Workstation Name
Renaming a Workstation that is a member of a domain
Using the MAC Address
No Local Administrator Rights?
Tips and Tricks
Modification History
Known Limitations
Exit Codes
FAQ
Credits
What's in the Pipeline
Disclaimer

 Want to Contribute? [Top]

I wrote the first version of wsname over 10 years ago when I was working for Novell's consulting practice where I specialised in directory design and desktop management using the then very new and very cool zenworks.

Over the years I've moved away from the coalface of IT but I still update wsname from time to time as I get requests for bug fixes, spelling mistake corrections or additional features.

If you use wsname and think you get some value from it, drop me an email to let me know where in the world you are from, it always gives me a kick to see where its being used.

If you think wsname is really really great and you have access to a company credit card, and you really really feel the need to help, I could really do with a new version of Delphi.  The one I have is fine, excepting it doesn't support Unicode, so or non English languages this can be a bind.  The latest version is about US$400 I think. Well out of my price range!


 What's New In This Version? [Top]
  1. Added option to allow form factor identifiers to be specified on the command line, was fixed at "D" for desktops and "L" for laptops

    For a full list of changes, see the change log

 Command Line Switches [Top]

/H /?

Opens this document

/N:<new name>
 

Silent Operation. Updates computer name without intervention, no dialogue is shown
This command switch supports the following variables:

$MAKE

Computer Manufacturer from the BIOS using WMI (WMI functions require Windows 2000 or later)

$MODEL

Computer Model from the BIOS using WMI

$SERIALNUM

Computer Serial Number from the BIOS using WMI

$ASSETTAG

Computer Asset Tag from the BIOS using WMI (SMBIOSASSetTag From Win32_SystemEnclosure)

$CHASSIS

Computer Form Factor, returns "D" for desktops, "L" for laptops using WMI

$CHASSIS[<D>;<L>]

Computer Form Factor, specify strings for desktop or laptops

$MAC

MAC Address of the primary Ethernet Adapter as the Computer Name

$MAC2

MAC Address of the primary Ethernet Adapter as the Computer Name, forces use of the IPCONFIG method (refer here)

$IP

IP Address of the primary Ethernet Adapter as the Computer Name (swaps the '.' for '-' to avoid DNS confusion)

$DNS
$DNS:<dns server>

Determine Workstations new using Reverse DNS lookup, see below for more details for reverse lookup mode

$USERID

Name to the name of the currently logged in user

$OSVER TLA for OS Version (W95, W2K etc)
$RANDOM Generates a random 15 Character name
$CURRENTNAME The existing workstation name
$DD Day of the month 1-31
$MM Month of the year 1-12
$YY Short year 00-99
$YYYY Long year 1900-2100
/UNATTEND:

Writes the new name to a text file for use in a Unattended or SysPrep build process

/LOGFILE:

Allows you to specify an alternate location for the log file (normally in the %temp% directory)

/EXCLUDEADAPTERS[adapters]

Network Adapters to ignore when looking for the MAC address

/IGNOREMEMBERSHIP

Ignore Domain Membership checking

/WG:<workgroup>

Specify the Workgroup membership

/PG:<Name to Check>

Post Ghost mode, see below for more details on Post Ghost

/NS

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

/REBOOT

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

/NOREBOOT Suppresses reboot prompt in GUI mode
/MCN Sets 'My Computer' name on the desktop to the Computer Name
/SCD Sets Computer Description to the Computer Name
/SCD:<description> Sets Computer Description to specified string, enclose in quotes if the string contains spaces. Max length 256 characters.
/SDL Set Drive Label, sets the label of drive C:\ to the Computer Name
(On non-NTFS drives the name is truncated to 11 characters as this is the max length of a drive label with the FAT and FAT32 file system)
/LOT Sets "Log On To" option in the logon GINA to the machine name (WinNT + only)
/CHO Changes Host Name only (Leaves NetBIOS name unchanged)
/ADR Always Do Rename, WSName normally stops processing if the old and new names are the same, this switch ignores this test
/RCID Rename Computer in Domain
/USER: Name of user with rights to perform the /RCID operation
/PASS: Password of user with rights to perform the /RCID operation
/DELETEEXISTING For use with /RCID, will attempt to delete an existing account with the new name
/RDF: Read new name from data file
/DFK: Data file key
/LONGDNSHOST Allows long DNS hostnames to be used (up to 63 chars), NetBIOS names is truncated to first 15 chars
/NOSTRICTNAMECHECKING Using this switch relaxes the name checking rules, allowing pre Windows 2000 naming conventions to be used.
/REPSPACE Replace any space (" ") characters in the new computer name with dashes ("-")

 Silent Mode [Top]

Silent mode does not display the GUI interface and is initiated using the /N switch.

You can specify a new name or use a combination of variables to build a name that suits you requirements. You can also truncate strings ensure the result will fit in the 15 char size limit by specifying the size in square brackets "[]".
By default all strings are truncated from the left hand side, to truncate from the right append a "+" to the number. You can also use [L] and [R] to take the first whole word from the string.

eg: [6] First 6 characters from the left
  [+5] First 5 characters from the left
  [9+] Last 9 characters from the right
  [L] Characters before the first space
  [R] Characters after the last space

So putting it all together..

eg: wsname /N:WKS$MAC will give you a new name of WKS00508B052AE8
  wsname /N:W-$IP

"

W-10-0-0-100
  wsname /N:MYORG-$RANDOM[9]

"

MYORG-456278803
  wsname /N:$MAKE[4]-$RANDOM[10]

"

TOSH-KECJRTDJQU
  wsname /N:$CHASSIS-$MAC

"

D-00508B052AE8
  wsname /N:DELL-$MODEL[R]

"

DELL-520 (from a string of Latitude 520)


 Setting Workgroup Membership [Top]

The /WG:<workgroup> option gives the ability to change the Workgroup membership,  this command can be run either on its own or in conjunction with a rename.

e.g. wsname /WG:wgroup
or wsname /N:Computer1 /WG:wgroup

Note: Added in version 2.74 - Will not move a computer that is joined to a Domain into a Workgroup This function uses the NetJoinDomain API so is supported on Windows 2000 or later only

 Logging [Top]

WSName creates an extensive log of its operations in the %TEMP% directory (WSName.log). Check this out to see what WSName is doing.

If for some reason you want the logfile stored somewhere else, use the /LOGFILE switch

e.g. wsname /LOGFILE:\\myserver\share\wsname.log


 Renaming Remote Computers [Top]

Click here to view a sample VB script that enables you to rename remote computers (uses WMI so only Windows 2000 and above) or if you are more comfortable with Batch files then check out this version that uses PSEXEC from SysInternals.

 Post Ghost Mode [Top]

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 build 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 workstations name correctly.

 Reverse DNS Lookup [Top]

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

You can either parse the IP address of a DNS server that holds the PTR records for the target workstation, or allow WSName to use your primary DNS server setting.

e.g. wsname /N:$DNS
  wsname /N:$DNS:192.168.30.55

The GetNetworkParams API call is used to find the DNS server for supported operating systems, otherwise the program will try to use "winipcfg" or "ipconfig" and capture the output.


 Using the Unattend Option [Top]

This mode of operation writes the new name to a text file for use in a Unattended or SysPrep build process. It does not attempt to rename the computer or perform any other operations.

e.g. wsname /N:$CHASSIS-$MAKE[4]-$RANDOM[6] /UNATTEND:C:\SysPrep\SysPrep.inf

Will create or modify a text file called "c:\sysprep\sysprep.inf" with the new name in this format:

[UserData]
ComputerName = D-DELL-345678

 Using the Chassis Option [Top]

Using the "Chassis" option will create a variable based on the form factor of the device, basically its either a "Desktop" machine, or a "Laptop" or other portable type device. If you don't specify identifiers wsname will use "D" and "L".

If you want to use your own strings, add these to the command line as shown  in the example below.   

e.g. wsname /N:$CHASSIS-$RANDOM[6]
  wsname /N:$CHASSIS[DESK;LAP]-$RANDOM[6]


 Data File Mode [Top]

This mode of operation looks in a text file for the new name. This gives the ability to build up a data file that maps devices to their names. The most obvious identifier to search on is the MAC address or Serial Number

If the path to the data file or the search key contain spaces, you will need to wrap them in quotes.

Syntax
wsname  /RDF:DataFile  /DFK:SearchKey

Example

wsname  /RDF:"F:\DATA\MACAddress to PC Name.txt" /DFK:00508B052AE8 or
wsname  /RDF:"F:\DATA\MACAddress to PC Name.txt" /DFK:$MAC or
wsname  /RDF:"F:\DATA\MACAddress to PC Name.txt" /DFK:$SERIALNUM

Example Data File Format

00508B052AE8 = Computer1
005056C00008 = Computer2
005056C00001 = Computer3
....

 

 How WSName Works [Top]

Windows 9x and Windows NT 4.0

The workstation name is read using the "GetComputerName" API can and set using the "SetComputerName" API call, sadly both of these functions only concern themselves with the NetBIOS name, 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 and above - Rename Stand Alone Workstation

Windows 2000 and later support the new and improved SetComputerNameEx API, this allows us to set the Host and NetBIOS name together.

Windows 2000 and above - Rename Workstation in Domain

If the "Rename in Domain" option (/RCID) is selected the NetRenameMachineInDomain API is used, this renames the Workstation and updates the Domain or Active Directory with the new name. Remember that you will need to pass a username and password with appropriate Domain rights delegated to perform this function.

In all cases the workstation needs to be rebooted for the change to take effect.

 The Workstation Name [Top]

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

Windows 2000 or better:
Only the characters 'a-z', 'A-Z', '0-9' and '-' are considered valid. Additionally the name cannot start with a hyphen ('-') or be all numeric.
Valid names are generally set at 15 characters or less, however if  for some reason you do want to use longer computer names, Windows does allow the DNS host name to be up to 63 characters. To enable this use the /LONGDNSHOST switch. The NetBIOS name will be truncated to the first 15 characters.

Older Windows Versions:
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:

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

As WSName sets both the NetBIOS and Hosts names a computer name cannot contain a period (.) as the text to the right of the period would be treated as part of the DNS domain name.

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

 

 Renaming a Workstation that is a member of a Domain [Top]

Renaming a workstation that is a member of a domain is supported on Windows 2000 and later versions only.

This option requires access to the domain so a User ID and Password is required. For security the password is masked in the logfile.

eg: wsname /n:mynewname /rcid /user:mydomain\administrator /pass:secret

If you don't want to provide the password in clear text, there is an option to mask the password using the /PASSM: switch 

eg: wsname /n:mynewname /rcid /user:mydomain\administrator /passm:H#FG$RFGHYD4G6Hj

To get the masked password use the /MASKPASSWORD switch

eg: wsname  /MASKPASSWORD /PASS:secret

Note: If the new computer name already exists in the Domain the operation will fail with a 2224 error (The user account already exists). The same error occurs if you try to change the computer name through the GUI (my computer | properties | computer name | change). To avoid this you can use the /DELETEEXISTING option, this will attempt to delete the computer account and retry the operation.

Microsoft Support Document Q175023 shows the renaming of a Windows NT workstation to be very painful, I'm not going to code that!
 

 Using the MAC Address [Top]

The MAC Address checks for OS support of the GetAdaptersInfo API and will use it if available. If it's not there (Win95 and NT4) then the old unreliable NetBIOS method is used.

The NetBIOS method is known to fail sometimes if the machine is disconnected from the network (media disconnected) or if the machine has no NetBIOS support.

If the NetBIOS method does fail then the program will try to use "winipcfg" or "ipconfig" to capture the output. (if you want to force using this method you can use $MAC2 rather than $MAC)
Please note that as this method uses screen scraping it will fail on non English versions of Windows.

If you wish to use the MAC address as the machine name you should consider adding a character prefix as some MAC addresses are all numeric and this will cause the new name to be rejected by the name validity test.

eg: wsname /N:WS-$MAC will give you a new name of WS-00508B052AE8

You can use the /EXCLUDEADAPTERS switch to specify network adapters to ignore when looking for the MAC address. The matching check searches for the given string in the adapters description.

eg: wsname /N:WS-$MAC /EXCLUDEADAPTERS[WIRELESS WLAN BLUETOOTH PPP VMWARE IPSEC]

 

 Using WSName with Restricted Rights [Top]

In order to change a workstations name you NEED to have local administrator permissions. Lets say you want to call wsname from a logon script which runs under the context of a standard user, normally wsname will fail as it would have sufficient rights to perform the rename. One option is to use the RunAs command and some vbscript to run wsname with elevated permissions. Check out this example.

Note: It should be fairly obvious that using this technique will add some security exposure as the local administrator password will be visible to anyone looked an the contents of the script.

 Tips and Tricks [Top]

Using SQL to automatically create a self incrementing computer naming system.
Lets say you want to call your workstations WKS-1, WKS-2, WKS-3 and so on, but you're too busy or too lazy to set up a data file manually. You could create a simple text file using script and have the workstations add themselves, but the problem with using text files is that if two or more computers try to update it at the same time you will lose data. This example uses SQL to create a table of machine names based on MAC addresses and shells out to WSName if the name in SQL is not the same as the current name. View it here

 Modification History [Top]

Version Date Modification
2.93 9 April 2011 Added option to allow form factor identifiers to be specified on the command line, was fixed at "D" for desktops and "L" for laptops for Phillip
2.91 16 September 2010 Added the /REPSPACE switch to remove any space characters (" ") from computer names, some names retrieved under autogenerated using wmi under VMware contained whitespace - for Morten
2.90 10 September 2010 Added additional variables (date), added ability to truncate strings by whole word - was just by character length
2.88b 24 November 2009 Added detection for Windows 7.
2.88a 23 March 2009 Added detection for 64 bit Operating Systems. Added text parsing support for the computer description field.
2.87 7 December 2008 Added a TRIM statement to ensure that results from WMI queries are not returned with white space padding. Thanks to Matt and Gerben for pointing this one out.
2.86 16 March 2008 Added option to mask the password when using the /RCID domain option, thanks to Marius Gaudin for the routines
2.85 5 March 2008 Fixed an error when using the /RDF option where the new name wasn't reflected when using the /MCM and /SCD switches
2.84 5 February 2008 Changed the way the WMI calls are made. Hopefully it will work more reliably now. (I did use a nasty hack, now it should be all good)
2.83a 26 June 2007 Added the /UNATTEND switch for Tim, so you can write the new name to a text file for use with UNATTENDED and SYSPREP builds.
2.82 31 March 2007 Added the /LOGFILE switch so you can specify the location of the logfile if for some reason you don't like the default location in the %temp% directory.
Added the $CHASSIS option which returns "D" for desktops or "L" for laptops
Fixed bug where userids and passwords containing spaces where not correctly read from the command line
2.8 28 August 2006 Added the /EXCLUDEADAPTERS switch, in previous versions the code would exclude adapters with any of the following strings in the description: WIRELESS WLAN BLUETOOTH PPP VMWARE IPSEC.
Changed the version of UPX used for compressing the compiled code to 2.02
Removed IP address padding, in previous version all Octets would be padded to 3 characters, I thought this would be useful, I think I was wrong!
Added /NOSTRICTNAMECHECKING switch, using this switch relaxes the name checking rules, allowing pre Windows 2000 naming conventions to be used.
2.75j 26 April 2006 Added logic to ignore VMWARE and VPN adapters when using $MAC for Travers
2.75i 25 April 2006 Added logic to ignore WLAN adapters when using $MAC for Tim
2.75h 8 April 2006 Added logic to ignore Bluetooth adapters when using $MAC for Tim
2.75g 22 March 2006 Think I've sorted out the /deleteexisitng problem, thanks to Nick Payne for spotting the problem
2.75f 20 March 2006 More debug code, this time for the /deleteexisting switch
2.75e 13 March 2006 DSGetDCName wasn't working all the time, added additional logic to return the error code for tracking
2.75d 5 March 2006 Delete function still wasn't working as expected, problem only occurred when the user was logged in locally, added additional logic to fix this
2.75c 1 March 2006 Slight update to code, new delete function wasn't working as expected, added additional logging to track error
2.75b 19 February 2006 Added functionality to retry operation on rename in domain on error 8206 (AD is busy). Added new parameter (/DELETEEXISTING), this will attempt to delete a existing machine account when doing a rename in domain if a machine with the new name already exists
2.75a 29 January 2006 Changed command line macros from "%" to "$". Using "%" meant the command interpreter often stripped out the % and gave loads of people grief (I should have done this ages ago).
2.75 6 January 2006 Removed legacy calls to workstation manager that failed under ZENworks 7, removed "UNREG" functionality - this was superseded by zwsreg back in ZENworks 4, added some additional logging information when using the /RCID option
2.74n 20 November 2005 Added /LONGDNSHOST switch for Jay so long DNS hostnames can be used (Windows 2000 or better only). Tightened naming rules for computers running Windows 2000 or better, now only 'a-z', 'A-Z', '0-9' and '-' are valid
2.74m 19 November 2005 Added %ASSETTAG for Toni. Added logic to trap an exception error if WMI call was failing
2.74l 3 November 2005 Added %CURRENTNAME for Puhn. Added ability to use /MCN option without needing to change the computer name for Patrick
2.74k 27 October 2005 Added additional logic to string truncation routines to correct operation when specifying the same variable twice for Puhn
2.74j 10 October 2005 Modified the string truncation routine so you can specify truncation from left or right hand side for Puhn
2.74i 9 October 2005 Modified the %SERIALNUM call so it now queries WIN32_BIOS and if there is no serial number there it will now also look in WIN32_SystemEnclosure for Tammie
2.74h 10 September 2005 Added support for complex parameters to the /DFK for Michael
2.74g 2 September 2005 Added /IGNOREMEMBERSHIP for Remo Schwaller
2.74f 24 August 2005 Added %SERIALNUM
2.74e 23 August 2005 Added %MAKE and %MODEL options, removed a bunch of redundant code
2.74d 18 August 2005 Added logic to prevent renaming a machine that is joined to a Domain unless the /RCID option is specified
2.74c 12 August 2005 Reworked /SDL option to detect the Windows drive rather than assuming it was on drive C:, added support for longer labels on NTFS drives (did truncate to 11 chars for all drive formats)
2.74b 12 August 2005 Fixed case sensitivity bug where values were not being truncated as expected. Thanks to Adam Hauerwas for spotting this.
2.74a 8 August 2005 Internal code change to use different method for detecting Domain or Workgroup membership. No functional differences.
2.74 7 August 2005 Added functionally to support changing of Workgroup membership (/WG:) for Greg Jones. Removed NetWare client and Workstation manager information from the form - it's still in the code and details are in the logfile.
2.73d 4 August 2005 Fixed bug where wsname would throw an error if the %MAC switch was used in a machine with no network adapters (or the adapters are disabled). Thanks to Jon and Prakash for pointing this out.
2.73c 3 August 2005 Start of logic to enable changing of Workgroups for Greg Jones
2.73b 26 July 2005 Fixed bug where wsname would fail to rename on Windows Server2003 - thanks to Giuseppe for pointing this out
Removed imbedded help file
2.73a 9 March 2005 No code change, just updated the documentation (this file) and shrunk the executable using UPX (http://upx.sourceforge.net) to shrink its to 177k
2.73 14 November 2004 Added ability to specify a string for the computer description when using the /SCD switch for Greg Jones
2.72b 7 November 2004 No code change, just updated the documentation (this file)
2.72a 25 August 2004 Reworked the Wireless adapter logic for Michael so it would be used if no other NIC's are present
2.72 22 August 2004 Added some extra logic to ignore Wireless adapters when using the MAC address
2.71 24 March 2004 Added Random name capability for Leon Lukiyanets
2.70 16 June 2003 Added support for using variables when using the /N switch
2.66e 8 June 2003 Added support to sync the "NV Hostname" key on Novell Clients
2.66d 6 January 2003 Modification to name validity checking routine to disallow periods (.) in the name, fixed problem setting computer description  - Thanks Mikko Makela
Modified the MACAddress routine so it wouldn't try to use the GetAdapterInfo API call under NT4 - Thanks to Tony Wosnjuk
Moved to Delphi 7 (was Delphi 4)
2.66c 19 December 2002 Quick modification to the GetDNSServer function when I discovered that GetNetworkParams isn't supported on NT4. Thanks to Travers van Lierop
2.66b 18 December 2002 Added the ability to determine the DNS server IP address when using the Reverse DNS lookup mode (previously it needed to be specified)
2.66a 15 October 2002 Fixed an error in version checking which broke the "Rename in Domain" and set "My Computer" name functions - thanks to Krzysztof Skowron for spotting this
2.66 11 October 2002 Added extra checking to detect all-numeric computer names under Windows 2000 or above
2.65 15 August 2002 Added an alternative MAC address function, when all else fails, try "winipcfg"   - thanks to Peter van der Woude
2.64 6 July 2002 Added logic to ignore PPP Adapters when using the MAC address function
2.63 14 June 2002 Added log file roll over for Chuck Stuettgen
2.62 14 June 2002 Fixed problem in Win9X where %MAC% would be passed as an empty string. Now use !MAC, thanks to Rodney Hendricks and Anne Van Andel for point this out
2.61a 14 May 2002 Fixed bug in new GetMAC routine that truncated the MAC address to 11 characters - Thanks to Andrew Lozupone for spotting this
2.61 5 May 2002 Reworked the GetMACAddress function
2.60 25 April 2002 Added Data File Mode (/RDF) for Chris and Eric
2.51 Added OS version check to /RCID switch. Enabled /MCN for NT, 2K, XP - thanks Sterling
2.50 Added "Rename in Domain" function (/RCID)
2.41a Fixed error in RenameComputer function where name matching was failing to to differing cases - thanks to Ivan Sears for pointing this one out.
2.41 Added the /SCD switch for Ben Horbul
2.40 Modified the /DNS option so it works correctly under Windows 2000
2.39   Added the /ADR switch for Tim Manley
2.38   Added the /CHO option for Marc Delisle
2.37   Added the /LOT option for Marc Delisle
2.36   Added the /MCN option for Hedy delos Santos
  Added /UMN (Use My Name for Computer Name) option
2.35   Added the exit codes for Tim Manley
2.34   Changed the way the reverse DNS mode worked to save around 40k on the program size and to avoid the momentary popup of the main form which has annoyed me since I added it
  Added /IP (IP Address for name) option
2.33   Added the /SDL option for Brett Parker
2.32   Added the /PRE option
2.31   Added /MAC option for Michael Horskey
2.30   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
  Corrected a bug in resolving HostName under W2K (other OS's OK)
2.20   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 [Top]
  1. Using WSName during the minisetup phase of Windows Installation:
    If you are calling wsname from the cmdlines.txt phase of minisetup, please note that WMI calls will not work.
    It appears the WMI provider is not available at this time.
    MAC address functions are ok as these don't use WMI.
  2. Refer to the section on Using MAC Addresses  (/MAC) for limitations under Win95 and NT4 prior to SP4
  3. WSName does not support unicode - this is a limitation of the Delphi 7 environment
 
 Exit Codes [Top]

If WSName exits normally there is no error code, however if an abnormal end occurs the following error codes are set.

  15   Not joined to a domain (/RCID mode)
  14   Search Key not found in Data File (/RDF mode)
  13   Filename specified in /RDF not found
  12   Search key for /RDF mode not passed
  11   Unsupported OS for rename in Domain request (/RCID mode)
  10   Request to Reboot Failed
  9   No local Admin Rights
  8   New name validity check failed
  7   Computer is already named the target name
  6   Rename failed - cause unknown
  5   Can't read MAC Address (using $MAC)
  4   Can't determine local IP address (using $IP or /DNS)
  3   Reverse Lookup Failed (using /DNS)

 

 Frequently Asked Questions [Top]

WSName and NetWare login scripts

WSName can be called from within NetWare login scripts but remember if your 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

What is WSName written in?

WSName is written in Borland Delphi 7, mostly because there is no requirement for any of the runtime support files as in Visual Basic. 

 

 Source [Top]

Get it here. I apologise in advance for my coding.

 Credits [Top]

Thanks to Francois Piette for the Reverse DNS lookup function, check out his WSocket components at http://www.overbyte.be
Thanks to Markus, Laszlo & John, I use their UPX to shrink wsname down to a more acceptable 200k. Uncompressed it's about 500k!
Thanks also to Marius Gaudin for providing the password masking routines.

 Under Construction - What's in the works [Top]
  1. Detection between Windows Server 2008 and Windows Vista (both report 6.0)
  2. Add the help information back in, probably just the basics
  3. Add ability to write log info the STDOUT for debugging
 Disclaimer [Top]

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.

Comments