Get/Set ComputerName
by Corey A. Serrins, Kent Feid and Patrick Warme

These tasks will work with both sysprepped images and scripted installs of XP/Vista/7/8
Major features include:
-using the K1 database
-using the K2 database
-using variable replacement
-using a data file
-dialog prompting
-and more...

There are 2 scripts included with this download, getcomputername and setcomputername, each has a 32 and 64 bit versions.

For complete instructions and commandline switches, please read the included README.txt file

Get/Set ComputerName Download

Back to K2000 Deployment Workbench

Version History
=======================================================

v. 2.0.0.0 [03/09/18]
- Properly identify Windows 10 (ESMCS-348)
- Changed how xml was modified from a search/replace to pure xml, which means that if doesn't exist, it will now be created (ESMCS-335)
- Moved log to \ProgramData\Quest\Scripting Ninjas
- Changed the way get/set read mac address and resolved a number of issues due to this (ESMCS-338)
- When model is VMWare, and $Serial model replacement, make serial number use characters from the right (ESMCS-339)
- Include looking at hostname for devices that were imported (ESMCS-340)

v. 1.5.5.2 [09/01/15]
-fixed an issue where [ ] ; characters weren't being stripped from the final computer name
-added Win10 to variable replacement

v. 1.5.5.1 [05/01/15]
-fixed issue where USB image deployments without network connection were failing

v. 1.5.0.1 [02/26/15]
-resolved an issue where the name in the unattend was not getting updated.

v. 1.5.0.0 [10/08/14]
-added /log to generate a log file for both get and set scripts.
-added variable replacement functionality to setcomputername
-added data file naming functionality to setcomputername
-added ability to use K1 database
-added ability to use K2 database

v. 1.3.0.0 [08/16/13]
-added /look: switch to getcomputername and setcomputername. If using this switch, it must be used in both applications.
-added /notrandom and /timeout: switch to setcomputername in case the name read was '*' (random) and that is undesired

v. 1.2.2.1 [10/02/12]
-modified an error to be more clear that the name file wasn't found or error with it.

v. 1.2.2.0 [08/03/12]
-added 15 character limit to the dialog box so user can't enter more than that.
-changed the default write drive letter to x:

v. 1.2.1.0 [08/01/12]
-added /drive to both get & set

v. 1.1.2.2 [05/20/12]
-changed dialog box so that timer was set, takes whatever name is is in box at that time.

v. 1.1.2.1 [05/04/12]
-fixed /timeout issue in getcomputername where it wasn't working at all.
-fixed issue where when timeout happened, computername was blank in getcomputername.

v. 1.1.2.0
-added in /debug

v. 1.1.1.2 [03/06/12]
-made maximum length of computer name 15 characters in get/set scripts, no exceptions.

v. 1.1.1.1 [12/22/11]
-removed guictrlread from nodialog, not sure why it was there, as we aren't reading gui
-was just looking for /dialog, changed it to read first 7 characters to match command line, like other options
-fixed bug where /dialog would not work unless the computer name was ""

v. 1.1.1 [11/21/11]
    for SI, there is no name, so by default it will be "*" which will assign a random name

v. .65  [03/09/11]
switch was added to getcomputername.exe to allow for a timeout period on the dialog box to ask for a computer name.
Synatax for /timeout switch is /timeout:30 to timeout after 30 seconds. At this point, the unattend file would be left alone, assuming that the computername is set to "*" computer would end up with a random name.
/timeout at this time is meant to work with /dialog, if /timeout is used without /dialog, nothing will happen and there will be no affect on the outcome, but there will be no timeout.
v. .60 [02/28/11]
switch was added to getcomputername.exe to allow for naming the computer from commandline with /name:"name". This is more for one-offs.
switch was added to getcomputername.exe to allow the user to have a pop-up window to enter the computername. This is convenient for machines that come out of the box from the manufacturer, without any previous naming scheme for an organization.
v. .50 [02/23/11]
all known issues were resolved
all situations were tested with imaging and scripted install on Windows XP/Windows 7 and both architectures.