If you want to image a lot of computers with a clean Windows 10 image, Microsoft has lots of built-in tools to help do this, but it’s easy to get lost and overwhelmed with their documentation. To alleviate that headache, I will explain step-by-step how to:
Copy
Before you can make an answer file, Windows needs to know what sort of answers can be applied. It finds this information from
Use
It’s easier to add customizations to a clean image rather than one that has already been customized, so I recommend leaving everything at the default and just moving on to the next step.
Run
Open an administrator command prompt and enter these two commands:
1. make a bootable USB drive:
Capture The Image To A
Insert the CD or USB stick into the computer you ran
Once booted into the WinPE environment, you will be presented with a command prompt. You will need to run the following commands to capture the image.
First, open the
First, select the disk
It’s most useful to save the image to a network share, but you can save it to another USB drive attached to the computer. So first, mount a network share and assign it a drive letter.
Deploy The Image To A Computer Using
Deploying the images is a similar process, but you will be using
Run these commands (once you are booted into WinPE) to deploy the image:
I typically just put one command in it, which removes the
Now, just type
(Optionally) Add Drivers To The
You may find that some computers need a special network driver or storage driver to complete the imaging successfully. If this is the case, you can add a driver to image. Be careful not to add too many or the image will get too big and won’t load since it runs from RAM.
Go back to the step where you copied the WinPE files to the C:\ drive. Now, instead of creating the install media (and
1. make a bootable USB drive:
- create and use an
Unattended.xml
file that will:- skip the initial setup screens
- create a local admin account
- activate Windows with a product key
- (optionally) configure other Window settings
- capture a deployable Windows 10
.wim
file usingsysprep
- deploy the image to multiple computers using the
dism
command line tool and WinPE - (optionally) add drivers to the
.wim
file
High-level Overview
I often found myself getting lost while trying to make a universal Windows 10.wim
image file, so in this section I will give a broad overview from start to finish of the steps needed to be completed. This will also lay out the structure of this article.- Install the Windows Automated Deployment Kit (ADK)
- Acquire a Windows 10 installation disc or
.iso
- Create an
Unattended.xml
answer file - Install Windows 10 on a spare computer
- Copy the
Unattended.xml
file to the spare computer - Run
sysprep.exe
using theUnattended.xml
file - Create a WinPE disc or bootable USB drive
- Boot the computer to WinPE after it shuts down
- Capture the image to a
.wim
file usingdism
- Deploy the image to a computer using
dism
Install The Windows Automated Deployment Kit
Download and install the Windows 10 ADK. You can just accept all the defaults the installer offers. You mainly need the Deployment Tools, but the other stuff that is pre-selected will be useful for some other projects, so keep them selected.Acquire A Windows 10 Installation Disc Or .iso
You will need some form of a Windows 10 install media.Create An Unattended.xml Answer File
You will need to create an answer file, which contains the settings you want to be applied at the time you deploy the image to a computer. There are many to choose from, but this article will walk though some basic ones that many organizations might use.
Copy install.wim
To Your Desktop
Before you can make an answer file, Windows needs to know what sort of answers can be applied. It finds this information from install.wim
, which is located at the root of the installation disc. Copy it to your Desktop since it cannot be read directly from the CD or .iso
.
Use install.wim
To Generate Some Categories To Answer
- Open Windows System Image Manager as an administrator
- Right-click in the lower-left corner
- Choose Select Windows Image…
- Navigate to your Desktop
- Open
install.wim
- Choose Yes on the dialog that appears
- Right-click in the top-right section
- Choose New Answer File…
- Stretch the windows and panes so they are easier to read
Begin Adding Answers To Your Answer File
Hard Drive Partitioning
Microsoft_Windows_Deployment
- Right click amd64_Microsoft_Windows_Deployment_neutral
- Choose Add Setting to Pass 4 Specialize…
- Expand amd64_Microsoft-Windows-Deployment-neutral within the Answer File pane
- Highlight ExtendOSPartition
- Set Extend to true
Computer Name, Product Key, Time Zone
Microsoft-Windows-Shell-Setup
- Right-click amd64_Microsoft-Windows-Shell-Setup_neutral
- Choose Add Setting to Pass 4 Specialize…
- Highlight amd64_Microsoft-Windows-Shell-Setup under the Answer File pane
- Set ComputerName to %COMPUTERNAME%
- Set ProductKey to your Windows 10 product code
- Set RegisteredOrganization to your company’s name
- Set TimeZone to Central Standard Time (or whatever time zone you are in)
Join A Domain
Microsoft-Windows-UnattendedJoin
- Right-click amd64_Microsoft-Windows-UnattendedJoin_neutral
- Choose Add Setting to Pass 4 Specialize…
- Expand amd64_Microsoft-Windows-UnattendedJoin_neutral in the Answer File pane
- Expand Identification
- Set JoinDomain to the name of your domain
- Highlight Credentials
- Set Domain to your domain
- Set a username and password
Set System Locale
Microsoft-Windows-International-Core
- Right-click wow64_Microsoft-Windows-International-Core
- Choose Add Setting to Pass 7 oobeSystem…
- Highlight wow64_Microsoft-Windows-International-Core in the Answer File pane
- Set InputLocale to en-US (or your country code)
- Set SystemLocale to en-US
- Set UILanguage to en-US
- Set UserLocale to en-US
Set The Out Of Box Experience (Bypass Setup Screens) And Create A Local Admin Account
Microsoft-Windows-Shell-Setup (again on a different Pass)
- Right-click amd64_Microsoft-Windows-Shell-Setup_neutral
- Choose Add Setting to Pass 7 oobeSystem…
- Expand Microsoft-Windows-Shell-Setup_neutral in the Windows Image pane
- Right-click OOBE
- Choose Add Setting to Pass 7 oobeSystem…
- Expand Microsoft-Windows-Shell-Setup_neutral in the Answer File pane
- Highlight OOBE
- Set HideEULAPage to true
- Set HideLocalAccountScreen to true
- Set HideOEMRegistrationScreen to true
- Set HideOnlineAccountScreens to true
- Set HideWirelessSetupInOOBE to true
- Set NetworkLocation to Work
- Set ProtectYourPC to 1
- Set SkipMachineOOBE to true
- Set SkipUserOOBE to true
- Expand UserAccounts in the Answer File pane
- Right-click LocalAccounts
- Choose Insert New LocalAccount
- Highlight LocalAccount
- Set Description to Local admin account
- Set DisplayName to a username of your choosing
- Set Group to Administrators
- Set Name to the same as the username
- Expand LocalAccount
- Highlight Password
- Set Password to a password of your choosing
Save Your Answer File
Save your answer file somewhere safe (preferably on a network share). You will need to copy it to a different computer later on.Install Windows 10 On A Spare Computer
Now you need a spare computer that you can install Windows 10 on. You can customize Windows after it is installed (the settings will be captured and applied when you deploy the image), but it’s usually safer and a better practice to apply any settings through the answer file.It’s easier to add customizations to a clean image rather than one that has already been customized, so I recommend leaving everything at the default and just moving on to the next step.
Copy the Unattended.xml File to the spare computer
Copy yourUnattended.xml
answer file from the previous step into C:\Windows\System32\Sysprep
.
Run sysprep.exe
using the Unattended.xml
file
Open an administrator command prompt and enter these two commands:cd C:\Windows\System32\Sysprep
sysprep.exe /generalize /oobe /unattend:Unattended.xml /shutdown
This will apply your answer file and shutdown the computer. The next time you start it up, it will be as if you just deployed it to a new computer so it will apply all your answers and do a fresh install. So it is important that you do not start the computer until you are ready to boot it into WinPE to capture the image (in a state before it has been booted).Create A WinPE Disc Or Bootable USB Drive
Remember, the computer you just installed Windows on needs to stay powered off until this disc gets created. So you should be running these commands from the computer you installed the WADK on.- Right-click the Deployment and Imaging Tools Environment
- Choose Run as administrator
- Enter the following commands
copype amd64 C:\WinPE
Next you can do one of two things:1. make a bootable USB drive:
MakeWinPEMedia /UFD C:\WinPE F:
2. make an .iso file, which you can burn to a CD:MakeWinPEMedia /ISO C:\WinPE C:\WinPE\WinPE.iso
If you made the .iso
, you will need to burn it to a physical disc. If you made the USB drive, you can move just move on to the next step.Boot The Computer To WinPE After It Shuts Down
Now that you have either a bootable CD or USB drive that has WinPE installed on it, you need to boot the test computer to that.
Capture The Image To A .wim
File Using dism
Insert the CD or USB stick into the computer you ran sysprep
on. You will need to boot to one of these devices (instead of the hard drive). This can be adjusted in the BIOS, but there is also sometimes a function key you can press that lets you choose what device to boot to on-the-fly. It’s different for every machine, but if you are reading this far, you probably know how to do this.Once booted into the WinPE environment, you will be presented with a command prompt. You will need to run the following commands to capture the image.
First, open the
diskpart
programdiskpart
Your prompt will change and the commands you enter now will be for assigning a drive letter to the partitions so you can capture them into an image file.First, select the disk
select disk 0
Select the first partition (the small reserved partition Windows creates) and assign it a letterselect partition 1
active
assign letter=r
Next, select the main Windows partition.select partition 2
active
assign letter=c
exit
You will now return the regular command prompt. You can now use the dism
tool to capture the images.It’s most useful to save the image to a network share, but you can save it to another USB drive attached to the computer. So first, mount a network share and assign it a drive letter.
net use j:\ \\server\share /user:username "password"
Now, you can save both partitions to their own image file:Dism /capture-image /imagefile:j:\w10reserved.wim /index:1 /ApplyDir:r:\
Dism /capture-image /imagefile:j:\w10.wim /index:1 /ApplyDir:c:\
Deploy The Image To A Computer Using dism
Deploying the images is a similar process, but you will be using diskpart
to wipe the hard drive so you can deploy a fresh image.Run these commands (once you are booted into WinPE) to deploy the image:
diskpart
select disk 0
clean
create partition primary size=500
select partition 1
active
format quick fs=ntfs
assign letter=r
create partition primary
select partition 2
active
format quick fs=ntfs
assign letter=c
select partition 1
active
exit
net use j: \\server\share /user:username "password"
Dism /apply-image /imagefile:j:\w10reserved.wim /index:1 /ApplyDir:r:\
Dism /apply-image /imagefile:j:\w10.wim /index:1 /ApplyDir:c:\
copy /Y j:\SetupComplete.cmd c:\windows\setup\scripts\SetupComplete.cmd
Notice the last two commands (these optional). You can create and store a file on the network share named SetupComplete.cmd
, which will run when the computer is finished being imaged.I typically just put one command in it, which removes the
Unattended.xml
file (sensitive information in this file is already obfuscated, but it’s nice to remove it anyway).del /f %windir%\system32\sysprep\unattended.xml
Note that you can build this file into the image, but this method is more useful if you want to change the commands that run at first boot.Now, just type
wpeutil reboot
and your computer will start up to a fresh install of Windows!
(Optionally) Add Drivers To The .wim
File
You may find that some computers need a special network driver or storage driver to complete the imaging successfully. If this is the case, you can add a driver to image. Be careful not to add too many or the image will get too big and won’t load since it runs from RAM.Go back to the step where you copied the WinPE files to the C:\ drive. Now, instead of creating the install media (and
.iso
or USB drive), run this command instead to mount the image to the local filesystem:Dism /Mount-Image /ImageFile:"C:\WinPE\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE\mount"
Then, add your driver (replace the file path with the path to your required driver):Dism /Add-Driver /Image:"C:\WinPE\mount" /Driver:"C:\Somefolder\driver.inf"
Now, commit your changes and unmount the image:Dism /Unmount-Image /MountDir:"C:\WinPE\mount" /commit
You should now be able to create your media same as before:1. make a bootable USB drive:
MakeWinPEMedia /UFD C:\WinPE F:
2. make an .iso
file, which you can burn to a CD:MakeWinPEMedia /ISO C:\WinPE C:\WinPE\WinPE.iso
Source from : https://jacobsalmela.com/2016/03/30/how-to-image-a-computer-with-windows-10-using-dism/
No comments:
Post a Comment