/build/static/layout/Breadcrumb_cap_w.png

Get/Set ComputerName

Get/Set Computer name
by Corey A. Serrins and Kent Feid

These tasks will work with both images and scripted installs of XP/Vista/7

Get Computer Name:
This is a preinstall task that will capture the name of the computer and store the name for usee.
To create this task, go to Library>Preinstallation Tasks.
From the "choose action..." drop-down menu, select Add New Application...
Give the task a name, such as "Get Computer Name"
Click on Upload to select the appropriate getcomputername executible, 32bit or 64bit
For the commandline field type "getcomputername.exe" or "getcomputername_x64.exe" (without the quotes).
*Note, the preinstallation and midlevel task have different architecture versions as KBE will only run the appropriate
architecture .exe.
How getcomputername.exe works:
1. The active nic is found and the MAC address recorded.
2. A file is created on the T: drive (petemp) with the MAC address as its name.
3. The computer name is recorded inside the file in step 2.
getcomputername can be run in 3 different ways in the commandline
getcomputername.exe Will get the computername of the existing machine, and record that in the MAC address file.
getcomputername.exe /dialog will popup a dialog asking what you would like the computername to be. This is typically used for one-offs where you want to manually set the computername.
getcomputername.exe /name:"Name of Computer" this option will assign the name in quotes to the MAC address file described above. You only need quotes if the name involves a space.
getcomputername.exe /timeout:seconds this option will set a timeout period on the dialog box that asks for a computer name. This is only used with /dialog.

Set Computer Name:
This is a mid-level task that will take the computername created by getcomputername.exe and inject it to the appropriate location on the target machine.
To create this task, go to Library>Postinstallation Tasks.
From the "choose action..." drop-down menu, select Add New Application...
Give the task a name, such as "Set Computer Name"
Select the K2000 Boot Environment (Windows) as the runtime environment
Click on Upload to select the appropriate setcomputername executible, 32bit or 64bit
For the commandline field type "setcomputername.exe" or "setcomputername_x64.exe" (without the quotes).
How setcomputername.exe works:
1. The active nic is found and the MAC address recorded.
2. The t: drive is searched for the file, and when found, the file is read and the computername recorded.
3. The computer is scanned to determine if the machine was a sysprepped image or a scripted install.
4. If the machine is a sysprepped image, it is determined if the machine has a sysprep.inf file or unattend.xml
5. In either case, the appropriate section is updated with the computername contents found in step 2.

--------------------------------------------To Do-------------------------------------------------------------
Add additional error checking for unattend files

--------------------------------------------Verion Information-------------------------------------------------------------
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 commandline, 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. .6 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. .5 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.

1 Comment   [ + ] Show comment
  • Do you have a separate get-set computer name script for Windows10? - geoffgarcia 6 years ago
    • Newest version was posted to the portal. - cserrins 6 years ago

Answers (0)

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ