winprep.ps1
edited
1# Create a Windows Setup Answer File
2# Docs: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/wsim/answer-files-overview
3# Docs: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/components-b-unattend
4# Docs: https://learn.microsoft.com/en-us/windows-hardware/customize/desktop/unattend/
5
6$wimMountDir = W:
7$wimFile = ""
8
9Dism /Get-ImageInfo /ImageFile:$WimFile | = $wimIndex
10
11# Mount a WIM image
12Dism /Mount-image /imagefile:$wimFile /index:$wimIndex /MountDir:$wimMountDir
13
14# TODO: Load answer file for fist-run configuration
15
16Dism /Image:C:\test\offline /Get-Features
17
18# Optimize image
19Dism /Image:C:\test\offline /cleanup-image /StartComponentCleanup /ResetBase
20
21Dism /Unmount-Image /MountDir:$wimMountDir /Commit