Change Hostname Early / Client Hostname Changer
-
Hello.
I wonder if these two settings do the same thing or is there any difference between?
Thanks.
-
@willian Although I am not exactly sure I understand your question I will try to answer.
The option “change hostname early” will make FOS (FOG Linux OS - doing all the imaging work) run some registry modification scripts that do change the hostname of your machine after imaging but before it booting the first time.
On the other hand what you call “Client Hostname Changer” I suspect to be the Hostname Changer Module we have in the fog-client software. This will check the hostname of your machine when the client host OS is booted up and running the fog-client service. In case it finds the hostname to be different it will try to change it and reboot the machine.
-
Hi @Sebastian-Roth that’s exactly what I wanted to know. I keep the Change Hostname Early enabled, as in the picture I posted, but the hosts “receive” random hostnames, DESKTOP-XXXXX. As I use sysprep to create the golden image, I do not include the ComputerName option in the unattend.xml file. I’ve also performed a debug deploy task to check:
-
@willian I am not familiar with sysprep but @george1421 might know if this should work.
-
@willian I’m not sure what your problem is here. Your OP was an either or.
I can tell you that if you don’t set a computer name in the unattend.xml file you will get exactly what you are seeing. Then fog should rename the target computer when the fog client service is run.
I can also tell you I don’t use FOG to set the computer name because of our naming convention. I CAN calculate the name at install time. I use a post install script to update the unattend.xml file on the target computer after the image has been deployed but before the first boot of WinSetup/OOBE.
You can see how I’m doing this in this tutorial: https://forums.fogproject.org/topic/11126/using-fog-postinstall-scripts-for-windows-driver-injection-2017-ed Specifically this script: fog.updateunattend Where I use sed to change the name of the computername section to what fog’s internal host name variable is
$hostname
. For full disclosure my post install script is a bit more complicated since the $hostname variable is calculated when the script is run. But the fog.updateunattend script give a few examples of what could be done. -
@george1421 I had understood that by enabling the change hostname early, the hosts would have their hostnames changed during or after the deploy of the image, according to which they were registered on the server. For example, if I registered a host like Test-123, after deploy the image that would be its hostname.
-
@willian Since I don’t use that function I had to reverse engineer the code to see how it should work.
Long story short I expect that this process will not work with windows 10 (at least). This feature updates the registry directly post image push. I suspect with Win10 all registry entries are updated during WinSetup/OOBE.
Here is the code segment that is supposed to set the host name:
# Changes the hostname on windows systems # # $1 = Partition changeHostname() { local part="$1" [[ -z $part ]] && handleError "No partition passed (${FUNCNAME[0]})\n Args Passed: $*" [[ -z $hostname || $hostearly -eq 0 ]] && return REG_HOSTNAME_KEY1="\ControlSet001\Services\Tcpip\Parameters\NV Hostname" REG_HOSTNAME_KEY2="\ControlSet001\Services\Tcpip\Parameters\Hostname" REG_HOSTNAME_KEY3="\ControlSet001\Services\Tcpip\Parameters\NV HostName" REG_HOSTNAME_KEY4="\ControlSet001\Services\Tcpip\Parameters\HostName" REG_HOSTNAME_KEY5="\ControlSet001\Control\ComputerName\ActiveComputerName\ComputerName" REG_HOSTNAME_KEY6="\ControlSet001\Control\ComputerName\ComputerName\ComputerName" REG_HOSTNAME_KEY7="\ControlSet001\services\Tcpip\Parameters\NV Hostname" REG_HOSTNAME_KEY8="\ControlSet001\services\Tcpip\Parameters\Hostname" REG_HOSTNAME_KEY9="\ControlSet001\services\Tcpip\Parameters\NV HostName" REG_HOSTNAME_KEY10="\ControlSet001\services\Tcpip\Parameters\HostName" REG_HOSTNAME_KEY11="\CurrentControlSet\Services\Tcpip\Parameters\NV Hostname" REG_HOSTNAME_KEY12="\CurrentControlSet\Services\Tcpip\Parameters\Hostname" REG_HOSTNAME_KEY13="\CurrentControlSet\Services\Tcpip\Parameters\NV HostName" REG_HOSTNAME_KEY14="\CurrentControlSet\Services\Tcpip\Parameters\HostName" REG_HOSTNAME_KEY15="\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName" REG_HOSTNAME_KEY16="\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName" REG_HOSTNAME_KEY17="\CurrentControlSet\services\Tcpip\Parameters\NV Hostname" REG_HOSTNAME_KEY18="\CurrentControlSet\services\Tcpip\Parameters\Hostname" REG_HOSTNAME_KEY19="\CurrentControlSet\services\Tcpip\Parameters\NV HostName" REG_HOSTNAME_KEY20="\CurrentControlSet\services\Tcpip\Parameters\HostName"
I might suspect that if the system wasn’t sysprep’d that this code “might” work as intended. But I can’t say for sure.
-
@george1421 So, since Change Hostname Early might not work for me since I use sysprep, could I enable Hostname Changer to do the check but not reboot the machine in a forced manner, but when it is manually restarted by the user?
-
@willian Sorry the restart is automatic and managed by the FOG Service. I still think the post install script to update the unattend.xml file is a good option.
-
@george1421 the next time I need to change something in the golden image I will test these scripts. Thank you.