Created
September 30, 2022 20:46
-
-
Save manelrodero/8afa6e489530a1510daa4abaad2ee98d to your computer and use it in GitHub Desktop.
Create Recovery partition using diskpart.exe (Task Sequence)
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
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment | |
$LogPath = $tsenv.Value("_SMSTSLogPath") | |
$UEFI = $tsenv.Value("_SMSTSBootUEFI") | |
If ($UEFI -eq $TRUE) { | |
"select disk 0", "list partition", "select partition 3", "shrink desired=984 minimum=984", "create partition primary", "format quick fs=ntfs label=Recovery", "set id=`"de94bba4-06d1-4d40-a16a-bfd50179d6ac`"", "gpt attributes=0x8000000000000001", "list partition" | diskpart.exe | Tee-Object -FilePath "$LogPath\Create-RecoveryPartition.log" | |
} | |
else { | |
"select disk 0", "list partition", "select partition 2", "shrink desired=984 minimum=984", "create partition primary", "format quick fs=ntfs label=Recovery", "set id=27", "list partition" | diskpart.exe | Tee-Object -FilePath "$LogPath\Create-RecoveryPartition.log" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment