(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.
Answers (1)
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