There are some steps which can’t be (easily) done with group policy objects. So it makes sense to create your custom Windows image if you have e.g. 3 workstations or more.
Microsoft offers software for deploying which is quite comfortable. In most cases, you do not even have to enter a cmd-command.
In the following steps, I assume you have a common Windows Server / Client environment with Hyper-V and Windows 7 / 8 / 2012 / 2012 R2 machines.
- On a Windows Server machine (2008 upwards), install Windows Deployment Services (WDS).
- In WDS, include a boot image like boot.wim from your Windows DVD, located in subfolder “sources”.
- Select the boot image in WDS, right-click and select “create capturing image”. This enables a useful tool to create the image later.
- Create a new virtual machine in Hyper-V. This will be your “template”. Configure it to boot from network (PXE) by default.
- Add a second HDD to it. The image will be saved there temporary.
- Install the Windows OS of your choice, e.g. 8.1, from your Windows DVD.
- Format the second HDD and assign a drive letter.
- Create a directory like c:deploy and add 2 sysprep links:
c:windowssystem32sysprepsysprep.exe /audit /reboot
c:windowssystem32sysprepsysprep.exe /oobe /shutdown /generalize /unattend:c:deploycopyprofile.xml
- As you see in the 2nd link, we can optionally create an XML file which tells sysprep to use the current profile to be used later as default. See this site for creating the XML file or download my file here (might only work for 8.1): CopyProfile. Place it in your VM under c:deploy.
- Run the first link (audit). Windows reboots and logs in with the local Administrator account. Ignore the sysprep window after login.
- Now make all changes to the VM you wish to deploy, e.g. install Office, some PDF printer, IP settings, Explorer view options, install updates, drivers etc.
- Run the second like (oobe). Windows shuts down.
- Power the VM on again and press P12 to make PXE boot your Capturing Image you created before with WDS. Make sure Windows does not boot from HDD! Otherwise reset it quickly or re-run the OOBE link (the Capturing GUI would not accept it).
- Place the image on the second HDD and connect to your WDS server to automatically upload it there.
- While the image is created, you might want to have a look on how to create an Unattended AnswerFile. This is useful if you e.g. want to enable your local Admin account by default, set local passwords, domain joins, keys, additional drivers etc. To create this, you need System Image Manager which is included in the Windows ADK.
- In WDS, open the properties menu of your new Windows image, and specify the path to your unattended.xml if you have one.
- Your custom image is ready to run. PXE boot your workstations to deploy it.
Basically, this can also be done without WDS and PXE, but it is more comfortable. E.g. if you want to deploy your image via USB stick, Windows PE etc., you can get in trouble because the image file might be larger than FAT32 accepts. So would need an additional drive separately for your image etc.
VAMT is a useful tool to manage Windows and Office licenses after deploying.
It seems like it is not possible to install updates when you are in audit mode. You should do this before running the sysprep audit link.
If you want to run scripts automatically at the end of the installation, have a look for “setupcomplete.cmd” here.
In 2012 R2, WDS capturing image can cause troubles (0xc000000f, …). Like described here, you could copy a boot.wim from a 2008 R2 WDS server into \your2012r2serverreminstbootimages…, or mount an unmount it with DISM command.
Windows 8.1 Upgrade DVDs might include only an install.esd file instead of install.wim. You need the .wim file for System Image Manager. Look at this tutorial for a workaround.