PowerShell Logo Small

Clear-Disk



This is the built-in help made by Microsoft for the command 'Clear-Disk', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Cleans a disk by removing all partition information and un-initializing it, erasing all data on the disk.

SYNTAX


Clear-Disk [-Number] <UInt32[]> [-AsJob] [-CimSession <CimSession[]>] [-PassThru] [-RemoveData] [-RemoveOEM] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Clear-Disk [-AsJob] [-CimSession <CimSession[]>] [-PassThru] [-RemoveData] [-RemoveOEM] [-ThrottleLimit <Int32>] -Path <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]
Clear-Disk [-AsJob] [-CimSession <CimSession[]>] [-FriendlyName <String[]>] [-PassThru] [-RemoveData] [-RemoveOEM] [-ThrottleLimit <Int32>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Clear-Disk [-AsJob] [-CimSession <CimSession[]>] [-PassThru] [-RemoveData] [-RemoveOEM] [-ThrottleLimit <Int32>] -UniqueId <String[]> [-Confirm] [-WhatIf]
[<CommonParameters>]
Clear-Disk [-AsJob] [-CimSession <CimSession[]>] [-PassThru] [-RemoveData] [-RemoveOEM] [-ThrottleLimit <Int32>] -InputObject <CimInstance[]> [-Confirm] [-WhatIf]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Clear-Disk cmdlet clears the disk by removing the partition and volume information.


If the disk contains active data volumes, then the RemoveData parameter is required as this will delete all data from the specified disk. This cmdlet will not clear OEM
recovery partitions unless ForceOEM parameter is also specified.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=294424
Format-Volume
Get-Disk
Initialize-Disk
New-Partiton
Set-Disk
Update-Disk

REMARKS

<

Examples


Example 1: Clear a blank disk

PS C:\> Clear-Disk -Number 1



This example clears disk number one only if it does not contain both data or OEM partitions.




Example 2: Clear a disk with data partitions

PS C:\> Clear-Disk -Number 1 –RemoveData



This example clears the disk if it has data partitions, but not if it also has OEM partitions.




Clear a disk with data and OEM partitions

PS C:\> Clear-Disk -Number 1 -RemoveData –RemoveOEM



This example clears the disk regardless of whether it contains data or OEM partitions.