Everything in one code base to automatically deploy windows (10+) to a bare metal machine by standalone media (USB drive)
- PC boot from ventoy partitioned disk (effect by Ventoy2Disk);
- Under ventoy UI, select ISO file to launch, then select unattend xml file for auto install process (effect by Download ISO, Unattended XML and Ventoy config);
- According the config in unattend xml file, e.g. ./unattendXML/unattend-UEFI-256G.xml:
- windowsPE pass:
- Config winpe env language
- Re-partition disk, install Windows system to target partition;
- offlineServicing pass:
- Install driver (effect by PC driver);
- specialize pass:
- Config time zone;
- oobeSystem pass:
- Config language;
- Skip oobe process;
- Create local admin account;
- Run first logon command -> triger the firstLogonScript.ps1:
- rename computer, naming pattern:
<motherboard band>-<bios serial number>
- set current user password (default password: root)
- ipconfig
- install language pack (effect by Lang pack)
- change system region
- install chocolatey (effect by Chocolatey)
- config winrm
- install o365 (effect by MS Office)
- config system language encoding
- Work around logoncount 1 issue
- set PC sleep after 5 hours
- set PC turn off screen after 30 mins
- enable remote desktop
- enable Hyper-V
- restart PC
- rename computer, naming pattern:
- windowsPE pass:
Prerequest: portable usb drive (at least 8G+, 32G is recommanded) with no data keep.
by scoop
scoop install ventoy
or chocolatey
choco install ventoy -y
or manually download and install from https://www.ventoy.net/en/download.tml
Launch Ventoy2Disk, partition and install ventoy to the the usb drive. BE CAREFUL! This step will delete ALL files in your usb drive.
this repo into root folder of the usb drive.
git clone --recurse-submodules https://github.com/fsdrw08/WinOS-Deploy-As-Code.git
After this step, you got this
E:\
+--WinOS-Deploy-As-Code ⬅️ you got these in step 4
\...
Run script .\Get-WinISO\Get-Win11ISO.bat to download the Windows 11 ISO to <usb drive label>:\ISO\Windows
, you can also download Windows 10 ISO by running .\Get-WinISO\Get-Win10ISO.bat. These script will download and use selenium for automate the ISO download process.
After this step, you got this
E:\
+--WinOS-Deploy-As-Code
| \...
\--ISO
\--Windows
\--Win11_EnglishInternational_x64v1.iso ⬅️ you got this in step 5
According to the machine disk size, verify the disk partition config in .\unattendXML\unattend-UEFI-*G.xml, if there is no disk size match to you, create a new unattended xml by youself.
After this step, you got this (if you create new one)
E:\
+--WinOS-Deploy-As-Code
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml ⬅️ you got this in step 6
| | \...
| \...
\--ISO
\--Windows
\--Win11_EnglishInternational_x64v1.iso
Update .\Copy-VentoyFiles\ventoy\ventoy.json to add your new unattend xml file in template path (if you did in last step). Then run script .\Copy-VentoyFiles\Copy-VentoyFiles.bat to copy ventoy configuration json file to the usb drive root folder. After this step, you got this
E:\
+--WinOS-Deploy-As-Code
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml
| | \...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso
\--ventoy ⬅️ you got these in step 7
\--ventoy.json ⬅️
For PC driver deployment during offlineServicing pass, reference .\Drivers\README.md, prepare drivers for the target machine you need to install. After this step, you got this
E:\
+--WinOS-Deploy-As-Code
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml
| | \...
| +--Drivers
| | +--HP_WKS_Z2_G4_W10_x64_6.00.A.1 ⬅️ you got thess in step 8
| | | \--... ⬅️
| | \...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso
\--ventoy
\--ventoy.json
For language pack offline deployment, reference .\oobeSystem\Langpacks\README.md, download language package ISO and extra the target language cab file to related folder.
After this step, you got this
E:\
+--WinOS-Deploy-As-Code ← you got these in step 4
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml ← you got this in step 6
| | \...
| +--Drivers
| | +--HP_WKS_Z2_G4_W10_x64_6.00.A.1 ←┐ you got thess in step 8
| | | \--... ←┘
| | \...
| +--oobeSystem
| | +--Langpacks
| | | +--Win11
| | | | +--README.md
| | | | \--Microsoft-Windows-Client-Language-Pack_x64_zh-cn.cab ⬅️ you got this in step 9
| | | \--...
| | \--...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso
\--ventoy
\--ventoy.json
For chocolatey offline deployment, run script
(local).\oobeSystem\Software\Chocolatey\Get-ChocoPackages.bat
or
(web).\oobeSystem\Software\Chocolatey\Get-ChocoPackages.bat
to download chocolatey nupkg installation file.
After this step, you got this.
E:\
+--WinOS-Deploy-As-Code
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml
| | \...
| +--Drivers
| | +--HP_WKS_Z2_G4_W10_x64_6.00.A.1
| | | \--...
| | \...
| +--oobeSystem
| | +--Langpacks
| | | +--Win11
| | | | +--README.md
| | | | \--Microsoft-Windows-Client-Language-Pack_x64_zh-cn.cab
| | | \--...
| | +--Software
| | | +--Chocolatey
| | | | +----chocolatey.1.0.1.nupkg ⬅️ you got this in step 10
| | | | \--...
| | | \--...
| | \--...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso
\--ventoy
\--ventoy.json
For MS office offline deployment, run script .\oobeSystem\Software\MSOffice\Download-Office.bat to download office installation files.
After this step, you got this
E:\
+--WinOS-Deploy-As-Code
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml
| | \...
| +--Drivers
| | +--HP_WKS_Z2_G4_W10_x64_6.00.A.1
| | | \--...
| | \...
| +--oobeSystem
| | +--Langpacks
| | | +--Win11
| | | | +--README.md
| | | | \--Microsoft-Windows-Client-Language-Pack_x64_xx-xx.cab
| | | \--...
| | +--Software
| | | +--Chocolatey
| | | | +----chocolatey.1.0.1.nupkg
| | | | \--...
| | | +--MSOffice
| | | | +--Office ⬅️
| | | | | \--... ⬅️ you got these in step 11
| | | | +--officedeploymenttool_xxxxx-xxxxx.exe ⬅️
| | | | \--...
| | | \--...
| | \--...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso
\--ventoy
\--ventoy.json
Finaly, you got this
E:\
+--WinOS-Deploy-As-Code ⬅️ you got these in step 4
| +--unattendXML
| | +--unattend-UEFI-xxxG.xml ⬅️ you got this in step 6
| | \...
| +--Drivers
| | +--HP_WKS_Z2_G4_W10_x64_6.00.A.1 ⬅️ you got thess in step 8
| | | \--... ↙️
| | \...
| +--oobeSystem
| | +--Langpacks
| | | +--Win11
| | | | +--README.md
| | | | \--Microsoft-Windows-Client-Language-Pack_x64_xx-xx.cab ⬅️ you got this in step 9
| | | \--...
| | +--Software
| | | +--Chocolatey
| | | | +----chocolatey.1.0.1.nupkg ⬅️ you got this in step 10
| | | | \--...
| | | +--MSOffice
| | | | +--Office ↖️
| | | | | \--... ⬅️ you got these in step 11
| | | | +--officedeploymenttool_xxxxx-xxxxx.exe ↙️
| | | | \--...
| | | \--...
| | \--...
| \--...
+--ISO
| \--Windows
| \--Win11_EnglishInternational_x64v1.iso ⬅️ you got this in step 5
\--ventoy ⬅️ you got these in step 7
\--ventoy.json ↙️
Plug in this USB drive to the target machine, boot from this USB drive, then Ventoy get load, select the related Windows ISO, and related unattend xml file according to the disk size, then the installation process will start.
Ventoy: Ventoy is an open source tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files.
Unattended Windows Setup: Use to automate the configuration and the deployment of Windows.
Apply unattended answer file to Windows 10 install media: Tutorial to config a unattend xml file
Create media for automated unattended install of Windows 10
git submodule add https://github.com/fsdrw08/Install-ChocoOffline.git oobeSystem/Software/Chocolatey
git submodule add https://github.com/pbatard/Fido.git