Rename WinPE hostname

2.5k views Asked by At

I am trying to get my WinPE environment to rename itself, I currently have a WinPE .wim that I use to deploy through a WDS server, it configures the disks and deploys the same WinPE environment into one of the partitions and makes it bootable. However I am needing the not bootable on disk WinPEs hostname to be changed from the random computer name "MININT-******" into what I need.

I have tried an unattend.xml and run wpeinit.exe /unattend:[path to unattend.xml]

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ComputerName>ASDF1234</ComputerName>
        </component>
    </settings>
</unattend>

I have tried many variations of the unattend.xml and every one in the wpeinit log file says

WPEINIT is processing the unattend file [Path]
==== Initializing Display Settings ====
No display settings specified
STATUS: SUCCESS (0x0000001)
==== Initializing Computer Name ====
Generating a random computer name
No computer name specified, generating a random name.
Renaming computer to MININT-*******.
Waiting on the profiling mutex handle
Acquired profiling mutex
Service winmgmt disable: 0x0000000
...

Everything works at this point except renaming the system, when using Rename-Computer with powershell it works but once it reboots it runs the wpeinit again which generates a random name it seems.

Any help would be much appreciated!

2

There are 2 answers

0
mr netlord On

I never handled to change this at this point. However - I change the Hostname after booting via startnet / Registry:

@echo Windows Registry Editor Version 5.00 > set_hostname.reg
@echo\ >> set_hostname.reg
@echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters] >> 
@echo "Hostname"="NEW_HOSTNAME" >> set_hostname.reg
@echo "NV Hostname"="NEW_HOSTNAME" >> set_hostname.reg
@echo\ >> set_hostname.reg

regedit /s set_hostname.reg >nul
0
Arthur B On

I think you need to use the "windowsPE" configuration pass.

<ComputerName> is not part of the schema, but it actually works if you add it manually.

You can try something like this:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="windowsPE">
        <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <EnableFirewall>false</EnableFirewall>
            <EnableNetwork>true</EnableNetwork>
            <ComputerName>ADSF1234</ComputerName>
        </component>
    </settings>
</unattend>