/build/static/layout/Breadcrumb_cap_w.png

(Windows) Naming a machine after it's been installed

Here's what I do and has been working for years.

For naming machines I do the following:

PRE-INSTALL TASKS

Name: DiskPart-NTFS

====== START ========
select disk 0
clean
create partition primary
select partition 1
active
assign Letter C
format FS=NTFS label="(C:) Local Disk" quick
exit
======= END =========

Name:  Collect PC Name

====== START ========
@ECHO OFF
SETLOCAL
ECHO.
SET /p COMPUTERNAME="Please enter the name of this workstation ==>"
@echo You answered %COMPUTERNAME%
SET /p Set_PC="Is this correct?(Y/N)
IF "%Set_PC%" == "N" GOTO runagain
IF "%Set_PC%" == "y" GOTO NamePC
IF "%Set_PC%" == "n" GOTO runagain
IF "%Set_PC%" == "Y" GOTO NamePC

:runagain
SET /p COMPUTERNAME="Please enter the name of the workstation..  "
GoTo NamePC

:NamePC
@echo You answered:
@echo PC Name     = %COMPUTERNAME%
@Echo MAC Address = %MAC_ADDRESS%
@Echo %MAC_ADDRESS% = %COMPUTERNAME%>>T:\computers.txt
@Echo %MAC_ADDRESS% = %COMPUTERNAME%>>C:\namedb.dat
@Echo %MAC_ADDRESS%>C:\%computername%.txt
======= END =========


POST INSTALL TASK

Then, using WSNAME.EXE, you can run a Post Installation Task such as:

Name : Rename PC
====== START ========
wsname.exe /RDF:c:\namedb.dat /DFK:$MAC /EXCLUDEADAPTERS[WIRELESS WIFI WLAN BLUETOOTH PPP VMWARE IPSEC CENTRINO MOBILE WI-FI]
======= END =========

-OR-

Rename the machine with PowerShell,
====== START ========
powershell -nologo -executionpolicy bypass -noprofile -file Ren_PC.PS1

(Contents of Ren_PC.PS1)
cd c:\
$a = dir *.txt | select BaseName
Rename-Computer $a[0].BaseName
======= END =========


Either one of these will work and you get to name the workstation before the image gets installed , but after the drive has been partitioned & formatted.


0 Comments   [ + ] Show comments

Answers (1)

Posted by: SMal.tmcc 6 years ago
Red Belt
0

have you tried using the tool the Kace provides (get/set computername)?



this switch will prompt you to name it

without the /dialog switch it will use existing name and apply it


 
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