Created
May 7, 2019 21:04
-
-
Save brianfgonzalez/03d9528a84836a55e450c40b67f13bf8 to your computer and use it in GitHub Desktop.
This script is meant to run in Windows PE and requires the following PE packages: StorageWmi, Powershell, and .NET
This file contains hidden or 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
if ((Get-Disk).NumberOfPartitions -eq 4) | |
{ | |
[System.IO.DriveInfo]::GetDrives() | ` | |
? { (($_.DriveType -eq 'Fixed') -and ($_.VolumeLabel -eq 'RECOVERY')) } | ` | |
% { | |
Write-Host ('{0}util' -f $_.RootDirectory) | |
if (test-path ('{0}MININT' -f $_.RootDirectory)) { Remove-Item ('{0}MININT' -f $_.RootDirectory) -Force -Recurse } | |
if (test-path ('{0}_SMSTaskSequence' -f $_.RootDirectory)) { Remove-Item ('{0}_SMSTaskSequence' -f $_.RootDirectory) -Force -Recurse } | |
if (test-path ('{0}util' -f $_.RootDirectory)) { Remove-Item ('{0}util' -f $_.RootDirectory) -Force -Recurse } | |
} | |
} else { | |
Initialize-Disk 0 | |
Clear-Disk 0 -RemoveData -Confirm:$false | out-null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment