none
ComputerName in Unattend.xml ignored by Windows 10 version 10240 RRS feed

  • Question

  • hello,


    I'hav the same probleme like this feed, but on the final version 10240 of windows 10:

    xxxxx://social.technet.microsoft.com/Forums/en-US/e359fe93-817d-4b90-b918-50cf906e5f9b/computername-in-unattendxml-ignored-by-windows-10-technical-preview-all-builds?forum=WinPreview2014Setup


    Since I was not successful in creating an Unattend.xml with  Windows 10 ADK I modified the one from Windows 8.1. This works with exception of

    <ComputerName>MYW10PCNAME</ComputerName>

    I do get an auto-generated PC name instead.

    The process is, that the Unattend.xml is copied into Panther folder after image build incl. sysprep.

    Can someone post an Unattend.xml that is working for Windows 10 (win 7, 8.1, Win Server 208R2 and 2012)


    my end unatteded.xml file :


    <settings pass="specialize">
            <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="xxx">
          <Display>
        <ColorDepth>32</ColorDepth>
        <HorizontalResolution>1280</HorizontalResolution>
        <VerticalResolution>1024</VerticalResolution>
       </Display>
       <ComputerName>EMASTER10</ComputerName>
      </component>
       <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="xxx" xmlns:xsi="xxx">
                <RunAsynchronous>
       <RunAsynchronousCommand wcm:action="add">
                        <Order>1</Order>
                        <Description>EnableAdmin</Description>
                        <Path>net user Administrateur /active:yes</Path>
                    </RunAsynchronousCommand>
                </RunAsynchronous>
            </component>
            <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="xxx" xmlns:xsi="xxx">
                <InputLocale>040c:0000040c</InputLocale>
                <SystemLocale>fr-FR</SystemLocale>
                <UILanguage>fr-FR</UILanguage>
                <UILanguageFallback>fr-FR</UILanguageFallback>
                <UserLocale>fr-FR</UserLocale>
            </component>
        </settings>

    And on the windows 10 iso file , they don't have the 'Install_windows 10 PROFESSIONAL.clg' file on Source directory to use Windows System Image Manager and manage unattend.xml file.


    Thank for any help.

    Joaquin

    Friday, July 31, 2015 9:12 AM

All replies

  • Hello,

    Thank you for your post.

    This is a quick note to let you know that we are performing research on this issue.


    Simon Wu
    TechNet Community Support

    Tuesday, August 11, 2015 4:08 PM
  • I can confirm that this is also happening on the Win10 Ent RTM build.
    Wednesday, August 12, 2015 6:22 AM
  • Hello Joaquin,

    we are using MDT 2013 Update 1 Preview patched as described here: blogs.technet.com/b/msdeployment/archive/2015/03/28/mdt-updates-for-windows-10-technical-preview-build-10041.aspx

    I probably had a similar problem. The sysprep-process aborted telling me that the unattend.xml is invalid. Checking the c:\windows\panther\setuperr.log it said the /settings/ComputerName was invalid. Deleting the setting from the settings pass="specialize" made sysprep succeed leaving the computer with a name DESKTOP-xxxxxxx.

    But the problem wasn't the setting itself or Windows 10, it was the length of the desired computername. This is limited to 15 characters, mine had 16. Cutting the computername to a maximum of 15 characters (and readding the <ComputerName>-setting to the component name="Microsoft-Windows-Shell-Setup" under settings pass="specialize" in the unattend.xml) solved the problem.

    Hopefully this helps you :)

    Reddich

    Wednesday, August 12, 2015 1:19 PM
  • Perhaps i should provide some clarification on my issue. Basically, I cant make windows prompt for the computer name after it comes out of sysprep. I have even tried leaving the <ComputerName> tag empty in the xml with no success. I have seen a couple posts online with the same issue but no solution. Any help would be greatly appreciated.

    Thursday, August 13, 2015 7:02 AM
  • For the Windows 10 OOBE, the Computer Name prompt has been removed. If you want to prompt a user for the computer name this will likely need to be a script that sets the computer name during the specialize phase of your answer file. Alternatively you could set it as a script to run during first logon that then restarts the computer.
    Monday, August 17, 2015 3:36 PM
  • Are you, by any chance, using the same ComputerName in the unattend file as you were using on the computer from where you generalized/captured the wim image?

    If so, try a different computer name in the xml. Does that work?

    Tuesday, August 18, 2015 12:49 PM
  • Hello,

    I tested with short computer names, this does not solve the problem.

    I tested the solution of Reddich; but it does not work on my setup

    We use the Windows 10 OOBE sysprep, it's for deploy lot of new computer with installation by provissiong without any manipulation by technical ou enduser (not by images like ghost or other tools)

    thanks for any help.

    Joaquin


    • Edited by JB of Wednesday, September 2, 2015 9:05 PM modification
    Wednesday, September 2, 2015 9:04 PM
  • ComputerName object in Specialize pass is also ignored if installing Windows 10 Pro OEM System Builder Kit with an answer file.

    Thursday, September 3, 2015 3:32 PM
  • I'm sorry if i misunderstood you but it seems you're not really responding to what i said. 

    What kind of wim image are you using? Did you capture it yourself or are you using the original one from the windows dvd? 

    If you captured one yourself: did you use the same ComputerName on the reference computer (the source of the .wim image) as in the .xml answer file (the desired computername for the new installation)? 

    For me the problem disappeared as soon as i started using a different ComputerName in the .xml file than the one used on the reference computer. 

    Friday, September 11, 2015 9:12 AM
  • hello,

    I use a modified image (Microsoft image + add patchs only, no software)

    My 'master' hav a name called MASTER, and in my Unattend.xml file, a script modify the <ComputerName>EMASTER10</ComputerName> line by a manuel entry like :

    <ComputerName>newname</ComputerName>

    Friday, September 11, 2015 10:19 AM
  • Too bad, seems we have hit different problems then.. 
    Friday, September 11, 2015 10:36 AM
  • Any updates on this issue? I am also seeing this same issue. 

    After running sysprep and rebooting, system auto generates a random name instead of prompting for a computer name. 

    Seems MS broke something in W10 as I can configure Windows 8.1 to prompt for a computer name.


    • Edited by Tony Inglima Wednesday, September 16, 2015 3:44 PM
    Wednesday, September 16, 2015 3:20 PM
  • Well, I think the computer name page has been removed from OOBE so I think it is a separate topic. You can find other ones about why the prompt is removed.

    This is strictly about the ComputerName object in the XML, which the documentation says is still valid for Windows 10 but is obviously not working.

    Thursday, September 17, 2015 2:34 PM
  • It's not entirely true that its just "not working", it IS working under some circumstances. 

    My process: 

    1) i create a reference VM using the normal windows installation process

    2) i run my generalize script (Y:\AutoUnattend.xml is my unattend file on a network drive): 

    copy y:\AutoUnattend.xml %HomeDrive%%HOMEPATH%\

    C:\Windows\System32\Sysprep\Sysprep.exe /generalize /oobe /shutdown /unattend:%HomeDrive%%HOMEPATH%\AutoUnattend.xml

    3) i boot up the pc in Windows PE and run my 'capture' script:

    dism /capture-image /capturedir:c:\ /imagefile:y:\ThinImage.wim /name:Seeas
    

    4) then, on a target computer, i run:

    diskpart /s y:\CreatePartitions-BIOS.txt

    dism /Apply-Image /ImageFile:"y:\ThinImage.wim" /Index:1 /ApplyDir:W:\

    5) I write a new copy of my y:\AutoUnattend.xml  to w:\windows\panther\Unattend.xml , with a modified ComputerName. 

    6) reboot the pc.

    This process was working fine for me in Windows 8.1. 

    On Windows 10, windows is ignoring the ComputerName and autogenerating one instead, if the ComputerName i put in the xml in step 5 is the same one as the one i used when installing the reference vm in step 1. 

    If i use a different name in step 5 than i used in step 1, windows picks up the ComputerName from the xml correctly. 

    Just thought that this information might help someone to solve the issue or at least further trouble shoot it while we're all waiting for a word from Microsoft on this issue.. 

    Friday, September 18, 2015 10:50 AM
  • I don't really follow why you're specifying a hardcoded ComputerName in XML with the path of Windows\Panther after sysprep is already completed.  My understanding is you would want to do that in the system32\sysprep folder prior to even running sysprep. I can tell you it does work when doing the latter.  I've found no case however where you have the option to be prompted for a computer name on Win10. Specifying a hardcoded name still works as does generating a random name.

    Friday, September 18, 2015 3:08 PM
  • I'm not really sure what you mean with "after sysprep is completed".

    Do you mean after running "sysprep /generalize" ? That only runs on the source/reference pc.

    I need a unique name for every work station so i specify it in the XML after applying the image to the hard drive of the "target" pc's, just before rebooting. This is only causing problems on Windows 10 when the ComputerName in the XML is the same as the name of the reference pc. 

    This thread is about Windows ignoring the ComputerName in the XML and autogenerating something random instead. You and Tony Inglima seem to be talking about another issue. 

    Monday, September 21, 2015 11:23 AM
  • This thread is about setting the name on the source/reference PC because it get lost during sysprep /generalize. It shall get the same name as before, after every image build; so it is the same and can be hardcoded.
    Monday, September 21, 2015 12:34 PM
  • I'm affraid i don't understand what you're trying to say.

    By the way, quote from the original post: 

    The process is, that the Unattend.xml is copied into Panther folder after image build incl. sysprep.


    Tuesday, September 22, 2015 2:35 PM
  • After running sysprep on the source machine and the OS shuts down consider it sealed, it's a done deal. My understanding is the XML is not intended to be altered after that. What you want to happen when deployed on the destination machine already must be specified in the XML when you ran sysprep on the source. Again my understanding is if you want a different name for every destination PC where this image is deployed then you have only one option on Win10 at the moment and that is to have the XML syntax specify that a random name to be generated. This business about altering XML after deployment, if it worked prior to Win10 that's cool but I'm not sure it was ever supported or intended to work that way. JMO anyway, I could be wrong.  If you specify a name in the XML that's what you'll get on deployment to the destination PC. If you want the end-user to specify the name, that doesn't work anymore, they won't be prompted. If I'm understanding you correctly YOU have been essentially acting as the end-user in that you've been deploying the image and then before first boot trying to inject a name of your choosing into the XML. If that was working it's a neat trick.

    • Edited by Clutch125 Tuesday, September 22, 2015 4:27 PM
    Tuesday, September 22, 2015 4:23 PM
  • Ok, let's put that whole "altering XML after deployment" business aside for a moment, because IMHO this is not really the point. 

    There are two places where you can specifiy a computer name: 

    1) During the initial installation of the reference PC

    2) In the Unattend.xml file (regardless of whether this is done before or after sysprep)

    In my experience, in windows 10, if the same computer name is used in 1 and 2, windows setup ignores the name in 2 and auto generates a name. 

    If 1 and 2 are NOT the same, the ComputerName from 2 IS honoured. 

    This problem did not exist in Windows 8.1 - it would always honour the name in the XML. 

    BTW, apart from the fact that Windows setup 'ignores' the XML ComputerName, it also fails to correctly join the domain if that is specified in the xml. 

    Tuesday, September 22, 2015 5:42 PM
  • If sysprep doesn't complete properly this can happen.  Basically if sysprep either didn't happen or it failed then it won't overwrite existing values in the OS.

    Most important details are logs. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/


    • Edited by Ty Glander Tuesday, September 22, 2015 6:32 PM
    Tuesday, September 22, 2015 6:28 PM
  • Well actually it IS overwriting the existing ComputerName, but only if it the new computername differs from the existing. 

    Since modifying the ComputerName in the XML *after* sysprep seems to influence whether it works or not, i find it very hard to believe that the problem occurs during the sysprep. 

    I would love to provide you with the logs, but i'm not using MDT, but just sysprep and dism from the command line. 

    I guess you need something from c:\windows\panther  ?

    Tuesday, September 22, 2015 8:20 PM
  • Setupact.log

    Most important details are logs. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/

    Tuesday, September 22, 2015 8:42 PM
  • Here you go: http://pasted.co/c348e8b9

    I think these two lines clearly show the problem (reference pc was called 'seeas-sander' and i was trying to use this same name in the xml): 

    2015-09-23 12:53:54, Info                         [Shell Unattend] ComputerName in unattend [seeas-sander] matches the current ComputerName [seeas-sander] 
    2015-09-23 12:53:54, Info                         [Shell Unattend] Skipping setting the same ComputerName

    It succesfully joins the domain:

    2015-09-23 12:53:57, Info                         [DJOIN.EXE] Unattended Join: NetJoinDomain succeeded!
    

    Then, a bit later on: 

    2015-09-23 12:55:53, Info                         [msoobe.exe] TASK: Begin running task SetComputerName...
    2015-09-23 12:55:53, Info                         [msoobe.exe] Setting computer name to [DESKTOP-LO876QN]

    The resulting installation has a DESKTOP-LO876QN as a computer name and it "thinks" it has joined the domain. However, if i try to log onto a domain account, windows says "The security database on the server does not have a computer account for this workstation trust relationship.". 

    My guess: This is a bug. Windows skips setting the computername because it is already set to the desired name, then joins the domain with the old computername and finally decides that since no name was explicitly set in the earlier steps, it should generate one. 

    Again, if i use another name in the xml, like 'seeas-sander-2', everything just works as expected: the name is honoured and the domain relationship is working. 

    Wednesday, September 23, 2015 11:28 AM
  • This tells me sysprep didn't succeed.  <humor> Save the sysprep save the world </humor>

    Most important details are logs. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/

    Wednesday, September 23, 2015 5:36 PM
  • Does it also tell you why it failed? Any idea how to save the world? 
    Wednesday, September 23, 2015 8:04 PM
  • Shell Unattend] ComputerName in unattend [seeas-sander] matches the current ComputerName [seeas-sander]

    It shouldn't be the current ComputerName. 

    Without the setupact.log from the actual sysprep no (although you will get better support on the sysprep failure from the Windows forums).


    Most important details are logs. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/

    Wednesday, September 23, 2015 8:30 PM
  • I guess that would be this one (from c:\windows\system32\sysprep\panther)? 

    http://pasted.co/055171a2

    Wednesday, September 23, 2015 9:03 PM
  • It would probably be in the captured WIM.

    Most important details are logs. If you are unsure how to post logs or where to find them then reference https://keithga.wordpress.com/2014/10/24/video-mdt-2013-log-files-basics-bdd-log-and-smsts-log/

    Wednesday, September 23, 2015 9:40 PM
  • Did you see the log on the url i posted? It seems to be the sysprep log as it starts with "Beginning of a new sysprep run.. "

    Here's the raw version of the file without ads and with only the log lines from the last sysprep: https://oele.net/logs/setupact_last_sysprep.log



    • Edited by Oele Thursday, September 24, 2015 12:04 PM
    Wednesday, September 23, 2015 10:06 PM
  • This is the log file to look at: C:\windows\panther\UnattendGC\setupact.log.

    Thursday, September 24, 2015 5:29 PM
  • Ok, I follow you now.  I have the same issue repeated here. However isn't it just a simple fix though? Use a name on the source PC that you'll never ever ever use on the destination PC? :)
    Thursday, September 24, 2015 7:26 PM
  • Yep, that's exactly what i was trying to say to the OP and others with the same problem :) 

    Still not sure whether he was having the same problem or something different. 

    Thursday, September 24, 2015 8:17 PM
  • hello,

    my final computer name don't have the same name than the master. All installation use a script to enter a personnal name.

    I have test with the same name to the master before the Sysprep, the problem is persistent.

    Friday, September 25, 2015 9:29 PM
  • HI Tony,

    I'm having the same exact problem as you! I'm wondering if you every found a way sysprep will prompt you for a computer name? if not how did you work around the issue? 

    Best,

    Eddie

    Sunday, October 4, 2015 10:06 PM
  • Helo,

    I don't resolve the problem now, no issu ?

    Best

    Monday, October 5, 2015 10:45 AM
  • Could you share your log files? Both C:\windows\panther\UnattendGC\setupact.log and c:\windows\system32\sysprep\panther\setupact.log ? 

    Monday, October 5, 2015 3:09 PM
  • For the Windows 10 OOBE, the Computer Name prompt has been removed.

    Where is that documented, and for $DEITY's sake, why was it changed?

    Or is it like the behavior change that now executes all of the OOBE settings even when MODE=AUDIT is set, which Microsoft "explains" by saying that this was the intended behavior all along, even though Vista, Windows 7, Windows 8, Windows 8.1, and the matching server setup programs behaved as documented and skipped the OOBE nodes in the XML file if MODE=AUDIT was set?

    Joe


    Joe Morris

    Wednesday, October 7, 2015 1:50 PM
  • hello;

    this is my log file :

    http://1drv.ms/1RxmMZI

    Friday, October 9, 2015 9:22 AM
  • Those are only the files from c:\windows\system32\sysprep\panther\  (= the sysprep logs)

    Could you share the log files from C:\windows\panther\UnattendGC\ from a target computer too?


    Friday, October 9, 2015 9:42 AM
  • hello,

    i'dont hav directory UnattendGC ; only panther , ActionFiles, en-US et fr-FR directory on c:\windows\system32\sysprep\

    Friday, October 9, 2015 11:46 AM
  • Look in  C:\windows\panther instead of c:\windows\system32\sysprep
    Monday, October 12, 2015 1:02 PM
  • hello,

    the computer name information is correct used if the sysprep is in OOBE and generalise cheked, not ok in Audit Mode.

    In Win 7 and 8.1, the audit mode is ok, not in Win 10.

    I test the OOBE sysprep to deploy my computers

    Joaquin

    Monday, October 12, 2015 2:33 PM
  • so entering the computer name is working for you?

     if so can you please post the complete details how you have done

    Thanks,

    Monday, October 12, 2015 10:29 PM
  • This sounds like a bug. OOBE should not be setting the PC Name if specialize already changed it, or if it decided it didn't need to be changed.
    Friday, October 16, 2015 2:25 PM
  • This sounds like a bug. OOBE should not be setting the PC Name if specialize already changed it, or if it decided it didn't need to be changed.

    Alternatively, OOBE *should* be opening a dialog to let the user set the hostname if no hostname has been specified anywhere in the AutoUnattend.XML file...which it did under Windows Vista, 7, 8, and 8.1, but no longer does on Windows 10. I suspect that this problem is collateral damage from the change that causes all of the nodes in the OOBE pass to be performed even when MODE=AUDIT is specified [*]: OOBE has already executed by the time setup stops in AUDIT mode, so <sarcasm> OF COURSE </sarcasm> there's no need to change the name when the resulting image is blown onto a new computer and booted for the first time.                   

    I put in a script for the first logon that asks the user for the new hostname...but should not have had to do the extra work.             

     

    [*] I opened a Premier incident on that problem; it was closed by Microsoft as a documentation error, with a note that the new behavior complies with the original design intent back before Vista was built...


    Joe Morris

    Friday, October 16, 2015 2:42 PM
  • Joe, When do you join the PC to the domain?  My main problem is that during the specialize pass it gets joined the domain as the intended PC name and then OOBE renames the PC (on the PC only, not on the domain) and it loses its trust with the domain.
    Monday, October 19, 2015 1:40 PM
  • Joe, When do you join the PC to the domain?  My main problem is that during the specialize pass it gets joined the domain as the intended PC name and then OOBE renames the PC (on the PC only, not on the domain) and it loses its trust with the domain.

    I don't automate the domain join. I'm a relatively large R&D facility, and for a number of reasons a large fraction of our PC inventory is not in the corporate domain. The image produced by the build process contains our standard software suite and is configured to meet our security requirements - the latter being driven by the fact that it's difficult to impose a domain GPO on a machine not in a domain... <grin>

    As a result I make no attempt to set the hostname during the build process. In Vista, Win7, Win8, and Win8.1 this resulted in a dialog being raised during OOBE asking for the computer name. In Win10 that dialog never appears and I've had to write a tool for the FirstLogon script to ask the technician installing the image for the proper hostname.

    Looking at the logs, both those produced by setup and my own instrumentation of the process I see three different hostnames during a build...but all of them are selected by Microsoft's code, and not by the people here who have to live with the problems it causes.


    Joe Morris

    Monday, October 19, 2015 7:48 PM
  • I wish someone can find a solution for windows 10 to prompt to enter the computer name

    for some reason with windows 10 it looks like it joined the domain but when a user logon its throws up trust relationship

    i have to logon as local admin and rejoin the domain back again in order for it to work

    never happened for win7 and win 8 prompted to enter computer name and joined the domain with out any errors

    Monday, October 19, 2015 9:22 PM
  • Hi Simon,

    Would really like to know if there is a fix or patch for this and how to apply this so i can start deploying windows 10 to our computers on site.

    Kind Regards
    Brad

    Thursday, October 29, 2015 3:27 PM
  • Hi I'm new to this party, but seeing the same issue. We use the MDT database, and in our lab where we re-image the same collection of PCs over and over, we keep computer records with the PC names tied to MAC addresses, to save a step and not pollute AD with dozens of random names.

    All was working well, til we discovored that our Windows 10 test image is ignoring the computername gathered during the DB query. Nothing has changed in our process, and the task sequence was built based off existing ones we've used for Windows 7, 8, and 8.1.  Sure seems like a bug to me.

    Thursday, November 5, 2015 1:14 PM
  • Following up on my own post, I discovered that I was using the same PC name for deployment as was used to build the reference PC. I usually use dedicated VMs for build and different ones for deploy, but in this case I ended up using a deploy side VM for build out of necessity, and as i said, the MDT database assigns the same name by MAC address.

    Technically this isn't an "answer", but it is a workaround, if you are pulling your hair out trying ti figure out why your test machine won't deploy correctly.

    As I said above, this appears to be a bug. It should, and always has in the past, re-use the same computer name without complaining. For some reason, now deploying a PC with a name identical to the name used for the reference image fails for me.

    A reply below states this is fixed in 1511. I haven't had a chance to confirm that yet.



    • Proposed as answer by JoeZeppy Thursday, November 5, 2015 6:12 PM
    • Edited by JoeZeppy Wednesday, November 25, 2015 2:12 PM
    Thursday, November 5, 2015 6:12 PM
  • JoeZeppy, unmark your post as an answer. It is still supposed to work even if the name is the same. The documentation does not show that the behaviour of this object has changed, thus it is not working as intended.
    • Edited by Tripredacus Thursday, November 5, 2015 6:48 PM
    Thursday, November 5, 2015 6:47 PM
  • Seems it was fixed with build 10586 / version 1511 / TH2. Yeah!
    • Proposed as answer by Andykn Wednesday, December 30, 2015 2:07 PM
    Wednesday, November 18, 2015 1:27 PM
  • What about LTSB users?
    Wednesday, December 30, 2015 2:07 PM
  • It seems that there is no way to fix the bug. Thanks.
    Tuesday, March 1, 2016 6:43 AM
  • Hi Joe -

    I was wondering if you had a sample FirstLogin script to use in regards to prompting for the ComputerName (Windows 10).  Thank you for your help!


    Thursday, March 10, 2016 2:08 PM
  • Hi Joe -

    I was wondering if you had a sample FirstLogin script to use in regards to prompting for the ComputerName (Windows 10).  Thank you for your help!


    With Windows 7 I have used EditUnattend.vbs (code below) to prompt to inject a COMPUTERNAME variable in to the sysprep process to the corresponding COMPUTERNAME setting in the;

    4 specialize - amd64_Microsoft-Windows-Shell-Seup-Neutral

    It works absolutely perfectly. Every time.

    Now it generates the error: Windows Could not parse or process unattend answer file [C:\Windows\Panther\unattend.xml] for pass [specialize]. The answer file is invalid. I am doing this with a VM using snapshots and because of this failure It cases the VM to go in to a reboot loop so I can't check the unattend.xml output.

    EditUnattend.vbs

    Do While answer <> vbYes
       computerName = InputBox("Enter the desired Computer Name:", "Computer Name")
       answer = MsgBox("Is this correct?" & vbCrLf & "Computer Name: " & computerName, vbYesNo, "Verify Name")
    Loop

    If fso.FileExists(unattendFile) = False Then
       wscript.echo "ERROR: Could not find the unattend file"
    Else
       'Read the unattend file in and replace apprpriate variables
       Set unattendFileObject = fso.OpenTextFile(unattendFile, 1)
       strContents = unattendFileObject.ReadAll
       strContents = Replace(strContents, "COMPUTERNAME", computerName)
       unattendFileObject.Close

       'Write the updated contents back to the unattend file
       Set unattendFileObject = fso.OpenTextFile(unattendFile, 2)
       unattendFileObject.Write(strContents)
       unattendFileObject.Close
    End If

    ' Launch setup (will use the modified unattend.xml)
    WScript.Sleep 5000
    WshShell.Run "%WINDIR%\System32\oobe\windeploy.exe", 0, True

    Friday, April 8, 2016 2:32 PM
  • Because Windows 10 removed the naming option in the OOBE. It makes re-imaging a pain, however I was able to get this working! I used the autounattend file to autologon the administrator account, and set a bat file in the startup programs that brings up a prompt for a name. It will then name the computer, reboot then join the domain and reboot once again. This however adds about 10-15 minutes to our re-imaging process but it works...

    Problems with this method:

    1) Lots of trouble-shooting needed to set up.

    2) Takes much longer.

    3) Does not overwrite old host names from active directory.

    4) Security issues ( Need to provide domain-admin credentials too add computer to domain without prompt! )

    5) Gives people who pass by the option to close out of the naming screen and then they have local admin rights.

    This is a long process and I hope Microsoft acknowledges this, however in the mean time I enjoy the benefit of not having to manually set all these names. Below I will provide the 2 scripts that are the method of what I currently use, one is a login script and one is a prelogin script. Also this has a nice interface for non-tech users who may need to name your computer.

    ___________________________________________________________________________

    LOGIN SCRIPT

    ##########################################################################################

        

    [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

    $counter = Get-Content C:\temporary.txt #THIS IS SO IT ONLY FIRES ONCE

    if ($counter -eq 1) {

    # 1. Change Computer Name ###########################################################################################

        $form1 = New-Object System.Windows.Forms.Form
        $form1.text = "Get Computer Name"
        $form1.Height = 150
        $form1.Width = 250
        $form1.formborderstyle = 3

        $Button1Result = {
            $UserInput = $TextBox1.Text
            Rename-Computer -NewName $UserInput
            "2" > C:\temporary.txt
            shutdown -r -f -t 03
            $form1.hide()
        }

        $TextBox1 = New-Object System.Windows.Forms.TextBox
        $TextBox1.Height = 23
        $TextBox1.Width = 200
        $TextBox1.left = 575
        $TextBox1.Top = 300
        $form1.controls.add($TextBox1)

        $Button1 = New-Object System.Windows.Forms.Button
        $Button1.text = "OK"
        $Button1.Height = 40
        $Button1.Width = 105
        $Button1.left = 623
        $Button1.Top = 335
        $Button1.add_click($Button1Result)
        $form1.controls.add($Button1)

        $Label1 = New-Object System.Windows.Forms.Label
        $Label1.text = "Please type in the name you would like to give this computer below."
        $Label1.Height = 30
        $Label1.Width = 500
        $Label1.left = 510
        $Label1.Top = 250
        $form1.controls.add($Label1)

        $form1.showdialog()
    }


    elseif ($counter -eq 2) {

        # 2. Delete Auto Logon ###########################################################################################

        Set-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoAdminLogon -Value 0
        Clear-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultUserName
        Clear-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultPassword

        # 3. Login To Domain #############################################################################################

    #THE LOGIN YOU USE HERE NEEDS TO BE A HIGH LEVEL ACCOUNT, this is why is               #password doc after use.

        $domain = "YOUR DOMAIN HERE"

    #BELLOW I KEEP MY PASSWORD IN THE PATH SHOWN, YOU WILL NEED TO                       #PUT PASSWORD IN THAT SAME FILE (Tpwds.txt)

        $password = Get-Content C:\Windows\System32\Sysprep\Tpwds.txt | ConvertTo-SecureString -asPlainText -Force
        $username = "$domain\USERNAME HERE
        $credential = New-Object System.Management.Automation.PSCredential($username,$password)
        Add-Computer -DomainName $domain -Credential $credential
        remove-item -path C:\Windows\System32\Sysprep\Tpwds.txt -force
        remove-item -path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\ConfigurePC.bat" -force
        "FINISHED" > C:\temporary.txt

        shutdown -r -f -t 03
    }
        # 4. Reboot ######################################################################################################

    PRE LOGIN SCRIPT

    #Fill Username and password with LOCAL credentials (not domain).

    Set-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name AutoAdminLogon -Value 1
    Set-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultUserName -Value "USERNAME"
    Set-ItemProperty 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon' -Name DefaultPassword -Value "PASSWORD"
    Copy-Item 'C:\Windows\System32\Sysprep\Autounattend.xml' -Destination 'C:\Windows\Panther'
    Copy-Item 'C:\Windows\System32\Sysprep\ConfigurePC.bat' -Destination 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp'
    "1" > C:\temporary.txt


    Wednesday, April 27, 2016 6:38 PM
  • Hello, Logon Script continuously fireing. This forum is public and publicly indexed. I suggest that unless you want emails from everyone in the world, that you remove your email address from your post. ;)
    Wednesday, April 27, 2016 9:06 PM
  • Hi, 

    The method that I use for the script involved joining it to the domain first then renaming it. All part of the same script. Only one reboot is needed, it changes the name in AD when you rename it. 

    HTH

    Tuesday, June 28, 2016 1:05 PM
  • Logon Script Continuously Fireing - Could you provide more details about where you would initiate this script within the answer file? 

    How do you include the .bat into the start up programs? Also how do you order the 2 scripts you provided? You say logon script but you wouldn't use a GPO for this. Thanks for your help, I really want to get this working as this would help greatly. 

    Friday, July 15, 2016 6:27 PM
  •  my solution at after first boot is a batch file

    set /p new_name=Enter new Computer Name :

    wmic ComputerSystem where "name='%ComputerName%'" call rename name="%new_name%"

    Friday, December 2, 2016 6:00 PM
  • Not sure if this was ever fixed for you folks, but I have not had any problems with Windows 10 recognizing our Unattend.xml computer names until....... today!  (May 15th, 2017)

    We recently re-compiled our WIM file to include all recent patches, and WAMO!  The machines were unable to join the domain because we don't allow domain names to be created by join operation.  We have a separate system that creates the accounts prior to when a system is imaged.

    Anyway - This is a major pain!  We're rebuilding the WIM from Anniversary Edition ISO (we're using x64 Windows 10 Enterprise Edition).  

    Anyone else run into this?

    Monday, May 15, 2017 11:02 PM
  • This only ever was an issue if the Sysprep failed in some way.

    Many questions such as where do I find logs and what logs are interesting are found in: MDT TechNet Forum - FAQ & Getting Started Guide Please take the time to read it. Also if you don't post logs your problem won't be easily solved.

    Tuesday, May 16, 2017 1:03 AM
  • From the following page: https://docs.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/microsoft-windows-shell-setup-computername

    "In Windows 10, users can no longer enter a computer name during OOBE as the name is auto-generated. To set a default computer name pre-OOBE, OEMs can configure ComputerName in the Unattend.xml file and specify a name for the computer. After OOBE, end users can change this default computer name after OOBE by changing it in the System Properties page."

    Saturday, August 12, 2017 10:00 PM
  • And broken again in 1803!  <style></style>
    Tuesday, May 15, 2018 11:04 PM
  • Hi,

    I have same problem since 1803 (work with 1709)

    Have you find solution ?

    Sunday, May 27, 2018 3:53 PM
  • This issue only happens to me if I build my reference image and sysprep it on the same machine that I image for testing. Try capturing the image and pulling it down on a different computer (VM or metal) . 


    • Edited by DAG- Tuesday, June 5, 2018 3:02 PM
    Tuesday, June 5, 2018 3:01 PM
  • No solution yet.  We are just working around the issue. As stated by DAG- below, it only seems to happen when a SysPrep'ed image is applied to the same system it was built on.

    <style><br _moz_dirty="" /></style>

    Wednesday, July 18, 2018 3:16 PM