Sysprep a Windows 7 Machine – Start to Finish V2

SPREAD THE WORD, TOGETHER WE HAVE CONQUERED SYSPREP :)

This is version 2 of a step by step guide on Sysprepping a Windows 7 machine from start to finish. I cannot take full credit on this because my first article had so many helpful comments and discussions that this is simply a combination of all the good advice written into a working guide. (I would especially like to thank George for his input on Cscript for auto activation and Nathan for input on Sysprep Audit Mode). This will guide you through the following:

- Audit Mode
- Building the unattend.xml file in WSIM
- copyprofile=true command to copy the default profile (no manual copy)
- Prompt for a computer name
- Enable Administrator account
- Administrator account logs in first time automatically
- Activate windows automatically with Cscript;
- Successfully copy over taskbar icons;
- Delete unattend.xml file automatically upon completion of re-image.

Here is a list of what you will need:

- Latest version of WAIK : KB3AIK_EN.iso Version 1.0
- Windows Vista or Windows 7 Machine to build the XML file on
- ISO or DVD of Windows 7 Installation (x32 or x64)
- WinPE Boot Environment : BrianLeeJackson WinPE 3.0 BootLoader

First we are going to walk through building the unattend.xml file (answer file) and then we will walk through the actual Windows 7 imaging process.

PART 1 – XML FILE CREATION

Step #1

If you have a Windows 7 installation DVD, insert it now. Or if you have an ISO of 7, go ahead and extract it to a folder on your desktop. (I recommend 7-zip).

Step #2

Launch Windows System Image Manager. Your start menu should look like the image below:

Windows 7 WAIK Version 1

Windows 7 WAIK Version 1

Step #3

Under the “Windows Image” header, right click and select new image.

Windows System Image Manager

Windows System Image Manager

Step #4

You will now want to browse to the .CLG file in your Windows 7 installation (I am using Windows 7 Enterprise x64 in my example). It is located in the sources folder. See Image below. You can select either the .clg file or the install.wim. Both will have the same result.

Selecting CLG File - WSIM

Selecting CLG File - WSIM

Step #5

Now we need to create a new answer file. Go to the file menu and select “Create New Answer File.” Right after creating one, go ahead and simply go to file menu and select “Save Answer File.” This will give your XML file a name and save location. I chose to name mine unattend.xml. Now you see we have two category folders, Components and Packages. Under the Components folder you see that we have 7 options:

-1 windowsPE
-2 offlineServicing
-3 generalize
-4 specialize
-5 auditSystem
-6 auditUser
-7 oobeSystem

Step #6

These are very important as these are the steps in which the unattend.xml file is sequenced.
The next part is a little confusing. You are going to add components, from under the “Windows Image” section on the bottom left hand side to the passes on your Answer File. To add a component, you can right click on them and select “add to # pass”. There are many different options you can add, but they have to be done in a certain order and pass otherwise your sysprep might fail. I am simply going to use the one I created as the example.

Answer File - Unattend.xml

Answer File - Unattend.xml

Here is more information about adding options under the passes:

1 windowsPE

Nothing required in my example.

2 offlineServicing

Nothing required in my example.

3 generalize

amd64_Microsoft-Windows-Security-SPP_6.1.7600.16385_neutral

Set 1 for SkipRearm to allow up to 8 rearms

4 specialize

amd64_Microsoft-Windows-Deployment_6.1.7600.16385_neutral

      1. Order: 1
        path: net user administrator /active:yes
        WillReboot: Never
    1. RunSynchronousCommand[Order="1"]

  1. RunSynchronous

amd64_Microsoft-Windows-Security-SPP-UX_6.1.7600.16385_neutral

SkipAutoActivation: true

amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral

Computer Name: Leave blank (we will deal with this at the end)
CopyProfile: true
Registered Organization: Microsoft (you must leave this in this section)
Registered Owner: AutoBVT (you must leave this in this section)
ShowWindowsLive: false
TimeZone: Pacific Standard Time

(Please view TimeZone settings here -> http://technet.microsoft.com/en-us/library/cc749073%28WS.10%29.aspx)

You can delete other sub-header components if you don’t need them.

5 auditSystem

Nothing required in my example.

6 auditUser

Nothing required in my example.

7 oobeSystem

amd64_Microsoft-Windows-International-Core_6.1.7600.16385_neutral

InputLocale: en-us
SystemLocale: en-us
UILanguage: en-us
UserLocale: en-us

amd64_Microsoft-Windows-Shell-Setup_6.1.7600.16385_neutral

RegisteredOrganization: Your Company Name
RegisteredOwner: Your Name

  • AutoLogon
      1. Password: Administrator Password
    1. Enabled: true
      LogonCount: 5
      Username: administrator

  • FirstLogonCommands
      1. CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (windows 7 license key)
        Order 1
        RequiresUserInput: false
        CommandLine: cscript //b c:\windows\system32\slmgr.vbs /ato
        Order 2
        RequiresUserInput: false
    1. SynchronousCommand[Order="1"]

      SynchronousCommand[Order="2"]

  • OOBE
    1. HideEULAPage: true
      NetworkLocation: Home
      ProtectYourPC: 1
  • UserAccounts
          1. Password: Administrator Password
        1. Action: AddListItem
          Description: Local Administrator
          DisplayName: Administrator
          Group: Administrators
          Name: Administrator

      1. LocalAccount[Name="Administrator"]

    1. AdministratorPassword: Administrator Password
      LocalAccounts

    If you have questions, look at my image above to see full layout of components, it should help.

    Step #7

    K, now go ahead and save your answer file as unattend.xml.

    Step #8

    If you want the sysprep to prompt for a computer name you need to remove a line from your XML file. Open up your XML file you saved with notepad and remove the following line:

    Unattend.xml Computer Name

    Unattend.xml Computer Name

    PART 2 – IMAGING PROCESS / RUNNING SYSPREP

    Step #9

    Install Windows 7 (Enterprise) from CD or USB flash drive, when you arrive at the welcome screen and it asks you to create a username, hit ctrl+shift+f3.
    This will reboot your machine and put your windows build in ‘audit’ mode.

    Step #10

    On reboot, you’ll automatically be logged in under the built-in Administrator account. A sysprep GUI box will appear, but you can close it and NOW begin to customize your profile.

    Step #11

    Install any software/drivers, make any profile customizations, etc.
    If you need to reboot, the computer will boot you back into the Administrator account. You will be stuck in this audit mode until you run sysprep with the /oobe parameter. After doing so, sysprep will delete/clean up the Administrator account, but if you have copyprofile=true in your unattended answer file, it will copy the customized Admin account to the default profile before deleting it.

    Step #12

    On the PC you are going to be running sysprep on, you need to create a folder called scripts in this directory: %WINDIR%Setup. Now you are going to create a CMD file within the %WINDIR%\Setup\Scripts directory. Right click and make a new text file called SetupComplete.txt. Remove the .txt extension and replace that with .cmd. You now have a SetupComplete.cmd file which windows will read the first time it boots up from the sysprep. We need to place a script inside the CMD file. Edit the cmd file with notepad and insert this line: del /Q /F c:\windows\system32\sysprep\unattend.xml. This script will delete your unattend.xml file after it has been used. The unattend.xml file is also copied to the C:\Windows\Panther directory, so you will want to add a second line to the CMD file, del /Q /F c:\windows\panther\unattend.xml. If you have passwords or cd keys stored in that xml file you don’t have to worry about it being left on the computer.

    UPDATE AS OF JUNE 16TH: Read my Taskbar Icons Tutorial before continuing.

    Step #13

    Once you have everything configured correctly, Copy or move your unattend.xml file to : C:windowssystem32sysprep. Now to run sysprep, navigate to that sysprep folder, hold SHIFT and right click and select “Open New Command Windows Here”. Next, input the following commands:

    sysprep /generalize /oobe /shutdown /unattend:unattend.xml

    Step #14

    Turn the computer back on and boot to WinPE 3.0 environment (USB stick or CD/DVD). You can use my BrianLeeJackson WinPE3.0 BootLoader to boot up from USB or CD and capture your image. Capture image and save image to network location.
    A Dell 960 or GX755 is a good standard for capturing when you want a generic image for use with multiple systems. Might require injecting additional drivers for 3rd party brands, HP, etc. Most should work though right out of the box.

    Step #15

    On reboot, Windows will run out of the box, as the /oobe is intended. As long as you put your cd key into the unattend.xml file, windows will be activated automatically in the background, you will be automatically logged into the administrator account, and the unattend.xml file is deleted. You are now ready to use the computer or join it to the domain. Enjoy!

    Tags: , , , , ,

    543 Responses to “Sysprep a Windows 7 Machine – Start to Finish V2”

    1. Jimmy says:

      Hi everyone,

      I am having some trouble with my unattend file. I have followed the entire guide and the only difference is that I am trying to capture the image using Symantec Ghost. Ghost works with capturing the image, so I believe the main problem is somewhere in the unattend file.

      Here is the error message I receive.

      Windows could not parse or process the unattend answer file for pass specialize The settings specified in the answer file cannot be applied The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup].

      I created and tested another unattend file that DID NOT contain the “specialize” section and it worked…..but I would really like the ability to automatically enter the product key, computer name, & organization name. My understanding is that those pieces of information reside in the specialize section of the unattend file and I am not having luck with that section. I have also tried entering one piece of info above at a time and nothing worked.

      Any help would be greatly appreciated!!

    2. Chad says:

      Ive done sysprep with xp several times easily with no problems and im a bit confused why in the middle of everything it says to install windows 7. shouldnt it already be installed if i need to create the xml file? cant i just install all the programs i want, create the file then run sysprep and save the image. Thats how i do it in XP makes much more sense that way. sorry if i sound like a noob im jw.

    3. Brad Wilson says:

      Chad,

      I have the same question as you. I want to setup my profile in my other user called user with all the settings that I want to give the client. I have done this and loaded my applications and then I get stuck when it says to install windows 7. Can we not just do what we used to. I understand to create the xml file but I need be able to just sysprep all of my settings and get up and running. Can anyone help.

    4. Schikitar says:

      Hi all,

      I’ve been repeatedly having the same issue(s). I had an image built to a certain point, just prior to putting it in Audit Mode I took an Acronis image that I could revert to. Then I booted in under a “Tech” account and put the machine into Audit Mode, upon reboot it would fail. I restored the Acronis image and tried again, failed again. Then I restored the Acronis image, logged in and removed our AntiVirus software (Microsoft Forefront Client Security – the one that should work!) rebooted again and then put the machine into Audit Mode and presto, it booted up as expected.

      So, if you have AV installed prior to Audit Mode, try uninstalling it, rebooting and then try Audit Mode again… oh, the other step I also tried was removing the machine from the domain, but I’m fairly sure it was the AV…

      Tip: We now make it standard practice to take Acronis images of our machines before we put them into Audit Mode…

    5. Kyle says:

      I’m getting close to a “usable” base image, but now my redirection keeps breaking other things.

      Specifically after I sysprep a folder is created under the user’s profile called Documents. Not My Documents, but just “Documents”. This points to the C:\ drive, which is bad, because all our redirection points to a network drive called H:\.

      Pics, Vids, Music is all redirected to H:\My and Personal is redirected to just H:\.

      Something about this redirection to the root of H:\ is creating a Documents folder.

      (all redirection is done through reg keys)

    6. [...] on how to generate the Unattend.xml file with the CopyProfile parameter please? I used this to help me build the unattend.xml to create the default profile. Reply With Quote [...]

    7. Hank says:

      This did work for somethings but not all. It did keep some of my settings for the local computer polices. It cleared the firewall settings back to not configured.

      It did not keep my setting for the start menu or taskbar.

      Also did not keep any application setting that I did make to like any of the office products or roxio.

      I am just not sure what direction I need to go in to have all settings to stick for my environment.

    8. [...] explains how to make it prompt for computer name by removing a bit out of the XML file at the end. Sysprep a Windows 7 Machine Also a couple of gotyas set the Rearm to 0 not 1 or you will get the same CMID if you are using a [...]

    9. Lee D says:

      I’ve made some tweaks to this how-to that works for me. In the SetupComplete.cmd file, I added a second line as follows: net user administrator /allow:no
      This disables the admin account that was used to set up the image. I then used the unattend.xml file to create an additional user that the system will auto login with.

      My problem is that this new user is created with the full admin controls of the local administrator which means the UAC does not prompt for elevated processes. I do not want this and am having a difficult time finding the right way of doing this. Copy Profile being set to True is useless if the new user that is being created is full no-restrictions admin. Even if I set this new account as “user” in the unattend it still has full access to everything. It is even set as a user only in the groups on the windows 7 machine.

    10. ManelR says:

      @Kyle:
      The problem with the “network location selection” is a bug. Please see http://www.deployvista.com/Blog/tabid/70/EntryID/136/language/en-US/Default.aspx.

      @Everyone:
      I’ve seen that there are some components/properties that can be used in different passes (for example, Display > Color Depth). Why?

      Thanks.

    11. jschuk says:

      Dheeren says:
      May 19, 2010 at 5:35 am

      followed all the steps, the sysprep ran, but when the machine boots after i restart it the graphic drivers are missing! all the programs etc are there, i dont understand what went wrong.
      can any one help?

      I ran into this with a network driver that I forced (let me choose…) the computer to use. I ended up using an older driver that Windows loaded automatically without having to force it. That driver remained peristant after the sysprep.

    12. Justin S says:

      Good morning,

      You will have considerable issues if you are using the SYSPREP with the Unattend file and then attempt to “apply” the image as you would with Windows XP. the Unattend file is read when using Window Setup. I strongly suggest you use the MDT 2010 toolkit. Using the toolkit, you can be assured your unattend file will be applied.

    13. DinYero Johnson says:

      For those who are looking to make customizations to the taskbar and have those customizations done to the default user profile, you will need to make use of this: http://social.technet.microsoft.com/Forums/en/winserverGP/thread/d172b4de-be7c-4149-8958-bebfe042ade1

      I simply copied the folder manually from the Administrator profile to the Default profile, and then copied those registry settings from the Administrator HKCU path to the Default profile’s HKCU path. You’ll need to load the NTUSER.Dat from the Default profile to copy over the registry entries.

      I tested this, and it works for the most part. What didn’t work is the exact placement of the icons (IE, Windows Explorer, WMP) or the customization I did to the Windows Explorer shortcut to open Computer instead of Libraries.

    14. ManelR says:

      Hi again,

      In this tutorial I’ve seen that you change “RegisteredOrganization” and “RegisteredOwner” in the “oobeSystem” pass but, as I’ve asked before, these values can be changed too in the “specialize” pass.

      What’s the difference between change these values in these 2 passes? In my XML (and in some others I’ve read while browsing) I have the values changed in the 2 passes … but I don’t know if this could be a problem.

      I hope someone can bring us some light in this subject …

      Thanks.

    15. Kaspars says:

      I got problem with SCCM 2007 OSD task sequence. It overwrote setupcomplete.cmd file and as a result I do not have my national settings (my location, etc.) applayed.
      My cmd file: control intl.cpl,, /f:”C:\Windows\Setup\Scripts\customsettings_UserLocale.xml”
      control intl.cpl,, /f:”C:\Windows\Setup\Scripts\customsettings_InputPreferences.xml”
      But as a result I got this: “%windir%\system32\osdsetuphook.exe /execute”

    16. Rick says:

      On the very last one, UserAccounts – how or where do I add/edit the Description, DisplayName, Group, Name? I went in and was able to enter the administrator password but not the rest. Is the AddListItem something I need to add from the drop-down menus? If so, I don’t see it. Other than that, this is a great write-up.

    17. [...] if manufacturer branding of the OS is causing the problems. I was recommended to look at this Sysprep a Windows 7 Machine and I am currently working through it. Reply With Quote [...]

    18. Joe says:

      Is it possible to have the sysprep prompt the user to add it to a domain? I basically want to name my computer and add it to my domain at the time sysprep runs but I want to manually type in the name, not have it automatically generate a name. Is this possible?

    19. Joel says:

      Is your procedure correct for OEM installs as well? I read somewhere you have to leave out anything pertaining to the license key. I would think you would use the OEM key.

    20. JeffoMatique says:

      For those who have the problem with the unattend answer file for pass specialize: The settings specified in the answer file cannot be applied The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup].

      To resolve this problem you may check if you dont have bad keys in HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList

      Maybe you have some profiles listed in there that are not existing anymore. If you do, sysprep crash when copyprofile=true, so you have to delete those bad keys.

      I didnt used the UserAccounts section in my sysprep.

    21. joel says:

      Will this procedure work with an OEM HP computer? I tried making a ghost image of a sysprepped unit (win7 pro OEM) and it came up looking for activation and would not accept the OEM key. It was activated before sysprepping. I had put the HP OEM key in the sysprep.xml, but it did not work.

    22. Jeff says:

      Using this method, how would I inject 3rd party drivers? Win 7 installs an NVIDIA driver, which is great. But not the specific version that I need. Ditto on the NIC driver. How do I set my own? I see that AIK has an option to ‘insert driver path’. Will this work? Which pass do I add this to?

    23. Joe says:

      Hello, what if I create and setup a computer with windows 7 pro volume license and its activated on this reference computer, with all the device drivers, windows updates, softwares, automatically enable local administrator account, automatically add to our domain using our “tech” username and “tech1″ password to add to domain. I want to skip Windows welcome screen, agree to eula agreement but prompt user for computer name. I want to include local administrator password on the answer file and I want for the answer file to generate SID to all computers getting this image. What settings would I use using the Windows AIK Imaging Manager?

    24. Ray says:

      Running sysprep in step 13 copied sysprep.xml to %windir%\panther\unattend.xml so this should also be added to the script in step 12.

    25. Ricky says:

      I am having the same problem as Andrew Fichera and Joe. I have narrowed down the problem, but don’t know how to resolve it.

      We have two domains right now (trying to move from one to the other). When the computer was being setup on the Domain1, we had no issues with the “Windows could not complete the installation. To install Windows on this computer, restart the installation.” However, when doing this on the Domain2, I have this issue, and can duplicate it.

      If I setup Windows 7 Enterprise 32-bit from disk (machine doesn’t seem to matter), and then join it to the domain under the audit user Administrator account, 1 reboot it works fine. To speed up the reboot process, I run ‘gpupdate /force’. While my machine is in the Computers container on the domain, no policy should be applied, but after a reboot, I ALWAYS get this error message.

      Any thoughts?

    26. Alan says:

      Thanks for this walkthrough it was very helpfull.

      Alan

    27. @Ray, Thank you for your comment, this has been added to the tutorial under Step #12.

    28. Mark Davis says:

      Thank you very much for all the hard work that went into this.
      Everything seems to be working fine, but I am having one problem.
      After I ran the sysprep process and the laptop shutsdown. I start the laptop back up, it goes through services and driver install process, but the video drivers roll back to the origenal version, not the updated one that I installed before I ran sysprep. Can anyone shed some light on this?

    29. [...] Now run sysprep as you normally would and the scripts are copied into the default profile. That means for every new user, the scripts pin the icons in the order you want, the script then deletes itself and never runs again. For the correct procedure on sysprepping your machine, read my Windows 7 Sysprep Tutorial. [...]

    30. If you are receiving this email it means you probably have read my Windows 7 Sysprep blog at one point or another. I would just like to let you know that I have a new tutorial on successfully copying over the taskbar icons during the sysprep. The taskbar icons are not part of the user profile and so you probably noticed that they didn’t copy over. Well, I have a workaround for this.
      http://blog.brianleejackson.com/copy-taskbar-icons-windows-7-sysprep

      Let me know what you think :) If this doesn’t interest you, don’t worry, I will not be spamming your email and you can delete it, just thought some people would like to know.

      Have a nice evening.

    31. Rob says:

      Can you post a copy of your XML file?

    32. Caley says:

      Is there a way to change the sysprep.xml file so that the administrator account will be created or allowed to remain on the base image but not autologon when booting a newly imaged machine?

    33. Misu3108 says:

      For those of you who had PROBLEMS INSTALLING A PRINTER after deployment here’s a quick tip:
      -check to see if you have this line in your registry:

      Windows Registry Editor Version 5.00

      [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\ThinPrint Print Port Monitor for VMWare]

      -if you do then just delete it from registry or use a reg file putting a “-” in front of the key

      [-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\ThinPrint Print Port Monitor for VMWare]

      That’s it. Hope it helps others as I tried for 3 days to install a network printer and finally I succeeded after deleting this key.

    34. [...] deletes itself and never runs again. For the correct procedure on sysprepping your machine, read my Windows 7 Sysprep Tutorial. Share and [...]

    35. Erik says:

      Fyi running cscript //b c:\windows\system32\slmgr.vbs /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX from unattend.xml (as in the example above) gets your product key saved as plain text in:
      c:\windows\panther\unattendGC\setupact.log

      I noticed that while checking my own windows deployment for errors.

      /Erik

    36. Xt0ph3r says:

      Hopefully I can help answer a question that some have asked…but I have only learned them through trial and error….

      For those whose drivers don’t carry over:
      Make this be it’s own Sysprep function. What I mean is create an unattend file with WAIK that ONLY has the Windows PlugandPlay NON-PE drivers [the exact name of the component escapes me right now] with the location of the drivers. For me, I took all of our models of machines and copied all of their driver files to C:\drivers and then I told the unattend file that they were in there.

      If you are going to grab them from a network location then specify the path and enter the credentials of an account that has access to that directory.

      I then copied that unattend file only to C:\Windows\System32\Sysprep and then executed [from the command prompt at that folder level] “sysprep /audit /reboot /unattend:nameofdriveronlyunattendfile.xml

      On reboot you will notice that the machine will spend quite a bit longer booting up at the “Preparing your computer for first time use” screen before it boots back up into Windows. You may even also have to verify the addition of any unsigned drivers that are being loaded as well.

      Once the machine is back up then you can delete the drivers folder that you temporarily copied over and then delete the driveronly unattend file from the sysprep folder.

      Apart from that I have found this tutorial to be very good at getting one started.

      I too am having intermittent problems with the copy profile option. I will have to check the registry to see if it has created extra users somehow.

    37. Ritchie says:

      I am stuck at step 7, I want to save the xml file but I got validation exceptions;
      The component does not have any updated settings. It will not saved to the answer file. This for all four components.

      Any hint/tips are more than welcome.

    38. Tim says:

      I am having the same problem as a few others above. I have my image and sysprep working fine, however, I need to have it prompt for a computer name and add that computer name to my domain. Where do I input this information in my unattend.xml file?

      Thanks for all of your input!

    39. Mike says:

      I have been able to successfully create 2 base images using the above tutorial. However, I am now having an issue trying to create an image that is on a RAID card. I did nothing different then before but when I try and sysprep is just hangs on the generalizing phase plugins and never shuts down. I am not sure what is causing this but does anyone have any ideas? Thanks in advance.

    40. I’ve set my User Account Control to the lowest setting, but those messages still pop up. Isn’t there some way to stop them short of opening every program on the computer and unchecking the “Always Ask Before Opening This File” box????

    41. Fred says:

      General question:
      step 9 pushes you into audit mode where you config the default profile. This happens when setting up the machine the first time. What if you want to make additional changes down the road? I would be using MDT to deploy the image so I’m not certain I would see that screen again.

    42. [...] nothing you can do apart from reinstall. Annoying to say the least. So I then followed this guide Sysprep a Windows 7 Machine thinking that creating a new unattend.xml just for this would do it, and sure enough, following the [...]

    43. tam says:

      You shouldn’t need to go into audit mode for CopyProfile. BUT, if you have multiple accounts, windows will loop through the entries in hklm\software\microsoft\windowsnt\currentversion\profilelist, and pick the profile with the most recently modified ntuser.dat, and copy those settings to the Default profile. And the profile Windows picks is unpredictable, because it writes to all profiles in the Generalize pass.

      2101557 All Customizations to Default User Profile Lost
      http://support.microsoft.com/default.aspx?scid=kb;en-US;2101557

      Btw, if setup fails with the message about Specialize and Microsoft-Windows-Shell-Setup, you probably have an entry in profilelist that points to a profile folder that you deleted.

    44. William says:

      Great walk-thru and very helpful. Just one thing – I’d like to be able to do all the same steps but have the sysprep ‘mini-setup’ prompt me for computer name and domain just as the old XP sysprep.inf would do in the [Identification] section. I’ve made several attempts at getting this step done in the new xml Specialized Section (x86_Microsoft-Windows-UnattendedJoin__neutral / Identification /JoinDomain ) but have failed each time. Any suggestions here would be great. Maybe this Step-by-Step could include a fork on the instruction to include how to add the system to the domain during setup as an option instead of logging in as administrator then adding to the domain. In our environment, we plan to leave the admina account disabled, and domain users added to the Power Users localgroup.

    45. Automated joining of domain solved - Erik Sundin says:

      First of all thank you for your guides, they were really helpful getting me started with Windows 7 deployment. I´ve been working on automating joining of domain + only having to specify a computer name during setup. I finally got everything to work as I wanted, bellow are my results. Including my sysprep.xml and my script files.

      A few things worth noticing:
      As i mentioned in a previous post i did not like that the product key got saved as plain text in c:\windows\panther\unattendGC\setupact.log, my solution avoids that while still activating windows.
      I made a script to delete script files + sysprep.xml since using setupcomplete.cmd for it deletes the scripts before they are run.
      Rather then activating the built in Administrator account I made a new local account but thats just a personal preference (also autologon is only done once).
      Since I´m from sweden you might not want to use my language or time zone settings. :)
      The account used to join the domain only got rights to do exactly that (for at least a bit more safety).

      sysprep.xml:

      1

      true
      XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

      sv-SE
      sv-SE
      sv-SE
      sv-SE

      true
      Work
      1

      *Password*
      false

      *Password*
      false

      Local Administrator
      Localadmin
      Administrators
      Localadmin

      *Company*
      *Name*
      false

      cscript //b c:\windows\system32\sysprep\domain-join.vbs
      1

      cscript //b c:\windows\system32\slmgr.vbs /ato
      2

      cscript //b c:\windows\system32\sysprep\cleanup.vbs
      3

      W. Europe Standard Time

      *Password*=
      false

      1
      true
      Localadmin

      My script files:

      domain-join.vbs:

      Set objShell = CreateObject(“Wscript.Shell”)
      objShell.Run(“powershell.exe -executionpolicy remotesigned -file c:\windows\system32\sysprep\domain-join.ps1″)

      domain-join.ps1:

      $user = “domain\user”
      $domain = “domain.organization.se”
      $pass = “Password”
      $password = ConvertTo-SecureString $pass -AsPlainText -Force
      $cred = New-Object System.Management.Automation.PsCredential ($user,$password)
      Add-Computer -DomainName $domain -Credential $cred

      cleanup.vbs:

      Set objShell = CreateObject(“Wscript.Shell”)
      objShell.Run(“powershell.exe -executionpolicy remotesigned -file c:\windows\system32\sysprep\cleanup.ps1″)

      cleanup.ps1:

      Remove-Item .\sysprep\sysprep.xml
      Remove-Item .\sysprep\domain-join.vbs
      Remove-Item .\sysprep\domain-join.ps1
      Remove-Item .\sysprep\cleanup.vbs
      Remove-Item .\sysprep\cleanup.ps1

      Hope you like it, regards

      Erik Sundin

    46. Phil says:

      Xt0ph3r,

      So did you run 2 XML files then ? One for the initial sysprep of the settings then another for your drivers ?

    47. Karl says:

      Hello Guys

      I’m a newbie to imaging Windows 7. I successfully upload an image of the windows 7 machine after shutting it down after running sysprep. When I boot into win pe 3 and apply the image from the network location i have my image on the machine does not find the bootloader and can’t boot.

      There must be something glaringly wrong on my side. I did everything in the guide. Maybe in gimagex i’m not doing something correctly?

      Any help would be appreciated

    48. Jake says:

      This walk through was a great help. Between this and a little bit a kludge, we got a working image for our organization. Thanks!

    49. LouisG says:

      I followed the directions found here: http://support.microsoft.com/default.aspx?scid=kb;en-US;2101557 and made sure that the Administrator account was the only account available. My unattend.xml has the CopyProfile=true statement in it, so I’m good there. However, when I run “sysprep.exe /oobe /shutdown /generalize /unattned:unattend.xml” it still doesn’t load the profile. When I look in %systemroot%\panther\unattendgc\setupact.log for
      [shell unattend] CopyProfileDirectory from c:\Users\Administrator succeeded.
      [shell unattend] CopyProfile succeeded.

      I don’t see these entries. What a convoluted, messed up, and unreliable design. I frankly think that MS doesn’t care. Does anyone have any idea what I could be missing?

    Leave a Reply