Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faisalmasood/118d7e1b629400193d8a92225be77969 to your computer and use it in GitHub Desktop.
Save faisalmasood/118d7e1b629400193d8a92225be77969 to your computer and use it in GitHub Desktop.
Script for WinPE to auto deploy a Windows 10 image.
echo select disk 0 > diskpart%ID%.txt
echo clean >> diskpart%ID%.txt
echo ** Creating system reserved partition...
echo create partition primary size=500 >> diskpart%ID%.txt
echo select partition 1 >> diskpart%ID%.txt
echo active >> diskpart%ID%.txt
echo format quick fs=ntfs >> diskpart%ID%.txt
echo assign letter="r" >> diskpart%ID%.txt
echo ** Creating OS partition...
echo create partition primary >> diskpart%ID%.txt
echo select partition 2 >> diskpart%ID%.txt
echo active >> diskpart%ID%.txt
echo format quick fs=ntfs >> diskpart%ID%.txt
echo assign letter="c" >> diskpart%ID%.txt
echo select partition 1 >> diskpart%ID%.txt
echo active >> diskpart%ID%.txt
echo ** Executing diskpart script...
diskpart /s diskpart%ID%.txt
del diskpart%ID%.txt
echo ** Mounting network share...
net use j: \\server\share /user:username "password"
echo ** Applying Windows reserved partition...
Dism /apply-image /imagefile:j:\w10reserved.wim /index:1 /ApplyDir:r:\
echo ** Applying Windows main partition...
Dism /apply-image /imagefile:j:\w10.wim /index:1 /ApplyDir:c:\
copy /Y j:\SetupComplete.cmd c:\windows\setup\scripts\SetupComplete.cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment