Change Hostname Early / Client Hostname Changer

  • Hello.

    I wonder if these two settings do the same thing or is there any difference between?

    Captura de tela de 2019-06-05 10-28-59.png


  • @george1421 the next time I need to change something in the golden image I will test these scripts. Thank you.

  • Moderator

    @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 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?

  • Moderator

    @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_KEY3="\ControlSet001\Services\Tcpip\Parameters\NV HostName"
        REG_HOSTNAME_KEY7="\ControlSet001\services\Tcpip\Parameters\NV Hostname"
        REG_HOSTNAME_KEY9="\ControlSet001\services\Tcpip\Parameters\NV HostName"
        REG_HOSTNAME_KEY11="\CurrentControlSet\Services\Tcpip\Parameters\NV Hostname"
        REG_HOSTNAME_KEY13="\CurrentControlSet\Services\Tcpip\Parameters\NV HostName"
        REG_HOSTNAME_KEY17="\CurrentControlSet\services\Tcpip\Parameters\NV Hostname"
        REG_HOSTNAME_KEY19="\CurrentControlSet\services\Tcpip\Parameters\NV 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 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.

  • Moderator

    @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: 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.

  • Senior Developer

    @willian I am not familiar with sysprep but @george1421 might know if this should work.

  • 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:

    Captura de tela de 2019-06-10 15-47-41.png
    Captura de tela de 2019-06-10 15-48-00.png

  • Senior Developer

    @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.