Clear-LocalDisk
OSD 21.2.22+
Last updated
Was this helpful?
OSD 21.2.22+
This function is intended to run from WinPE and is ideally used to clear all Local Disks returned by Get-LocalDisk. I use this to clear all Local Disks (OS and DATA) before an OS Deployment
I strongly recommend running it without any parameters. By default, the following information is presented
Clear-LocalDisk-Verbose is enabled
Detected UEFI and PartitionStyle are displayed
Get-Help Clear-LocalDisk
Get-LocalDisk | Format-Table is displayed

When the -Force parameter is used, things are a little different
Get-LocalDisk | Format-Table is displayed
Confirm for each LocalDisk
Get-LocalDisk | Format-Table is updated and displayed
PartitionStyle = RAW
NumberofPartitions = 0

This leaves no room for error as there are no confirmation prompts

Adding this parameter will initialize the Disk in either GPT or MBR. If the system is UEFI, then GPT is automatically enabled

Using this parameter you can override the automatic selection of the PartitionStyle. In this example, a UEFI with GPT would have been automatically selected, but specifying -PartitionStyle MBR overrode that

Last updated
Was this helpful?
Was this helpful?
Clear-LocalDisk -ForceClear-LocalDisk -Force -Confirm:$false