Create Windows Templates
you may connect us to get some ready to use OS Templates, or if you want to make your own Templates please try to follow this process as it is to have your windows machine provisioned correctly.
Windows Server
This procedure was tested with Windows server 2008 R2, the same procedure also work in 2012,2016 and 2019 as well.
- Create your windows VM and add any software you wish to have installed by default on it (the administrator password of the vm should be WinVPS@servaRICA)
- Write your windows product key in your windows vm and activate it
- Create a folder C:\scripts in the new vm
- Copy the below files from xenica package to the new VM in C:\scripts
- postinstall.ps1
- Startup.cmd
- unattend.xml
- xenica_auostart.ps1
- diskpar.txt
(you can download a copy of this files from HERE)
please check the installed PowerShell Version, if it is not v2.0 then you need to update both 'xenica_auostart.ps1' and 'Startup.cmd' files :
1- in both files search for :
PowerShell -Version 2.0
2- replace 2.0 with your installed PowerShell version .
- We need to make Startup.cmd run automatically on system startup (even before login to windows),
- for that we can use Local group policy editor , from run box type the below
gpedit.msc
- Expand Windows Settings
- Select Scripts (Startup/Shutdown)
- Double click Startup
- Click Show Files and copy/paste a shortcut of Startup.cmd file in to this folder
- Click the Add button on the startup properties , then Click Browse and double click on the script to choose it.
- “OK” out of all windows to apply the new settings.
- In the downloaded package you will find this file xenica\shell_scripts\windows\unattend.xml.
- If you are planning to have non-English windows template : open the unattend.xml file and change the following lines to match your language
<InputLocale>en-US</InputLocale> <SystemLocale>en-US</SystemLocale> <UILanguage>en-US</UILanguage> <UserLocale>en-US</UserLocale>
- Copy the unattend.xml file into the c:\windows\system32\sysprep directory
- In the command line run the following command
cd c:\Windows\System32\sysprep sysprep /oobe /generalize /shutdown /unattend:unattend.xml
- Install Xentools and Convert the VM to a template and the name of the template must include the word windows all lower case.