Last active
September 30, 2021 21:24
-
-
Save jacobsalmela/817839f9e742232d75c4 to your computer and use it in GitHub Desktop.
Script for WinPE to auto deploy a Windows 10 image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
I'm trying to create a script in uefi mode with the option to select the partition disk but I need a hand
@echo OFF
CLS
ECHO Prepare Hard Disk for uefi setup
ECHO ----------------------------------------
ECHO list disk > list.txt
diskpart /s list.txt
DEL list.txt>nul
ECHO.
SET /p disk="Which disk number would you like to prepare?"
ECHO.
ECHO --WARNING-- This will FORMAT the selected disk and ERASE ALL DATA
ECHO.
ECHO You selected disk ---^> %disk%
ECHO.
CHOICE /C YN /M "Is this correct "
IF %ERRORLEVEL% == 1 GOTO INIT
CLS
ECHO Preperation Aborted, No changes have been made...
ECHO.
PAUSE
EXIT
:INIT
ECHO sel dis %disk% > init.txt
ECHO clean >>init.txt
ECHO convert pgt >> init.txt
ECHO create partition efi size=100 >> init.txt
ECHO format quick fs=fat32 label="System" >> init.txt
ECHO assign letter="S" >> init.txt
ECHO create partition msr size=16 >> init.txt
ECHO create partition primary >> init.txt
ECHO shrink minimum=500 >> init.txt
ECHO format quick fs=ntfs label="Windows" >> init.txt
ECHO assign letter="W" >> init.txt
ECHO create partition primary >> init.txt
ECHO format quick fs=ntfs label="Recovery tools" >> init.txt
ECHO assign letter="R" >> init.txt
ECHO set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> init.txt
ECHO gpt attributes=0x8000000000000001>> init.txt
ECHO exit >> init.txt
:RUN
CLS
diskpart /s init.txt
DEL init.txt >nul
ECHO.
ECHO This drive is now prepared for WinNTSetup_X64.exe
ECHO.
PAUSE
EXIT