Initialize-Disk

Initialize a RAW disk for first time use, enabling the disk to be formatted and used to store data.

Syntax
       Initialize-Disk { [-Number] UInt32[] | -UniqueId String[] | [-FriendlyName String[]] |
           -Path String[] | -InputObject CimInstance[] | [-VirtualDisk CimInstance] }
              [-PartitionStyle PartitionStyle] [-CimSession CimSession[]]
                 [-ThrottleLimit Int32] [-AsJob] [-PassThru] [-WhatIf]
                    [-Confirm] [CommonParameters]

Key

   -AsJob
       Run the cmdlet as a background job.
       Use this parameter to run commands that take a long time to complete.

   -CimSession
       Run the cmdlet in a remote session or on a remote computer.
       Enter a computer name or a session object, such as the output of a New-CimSession or
       Get-CimSession cmdlet. The default is the current session on the local computer.

   -Confirm
       Prompt for confirmation before executing the command.

   -FriendlyName 
       A friendly name of the disk to initialize.

   -InputObject
       Specifies an input object to be used in a pipeline command.

   -Number
       The disk number of the disk to initialize.

   -PartitionStyle 
       The type of the partition.
       Acceptable values for this parameter are: MBR or GPT.
       The disk must be set to read-write (IsReadOnly $false ) before this cmdlet will work.

   -PassThru
       Send items from the interactive window down the pipeline as input to other cmdlets.
       By default, this cmdlet does not generate any output. To send items from the
       interactive window down the pipeline, click to select the items and then click OK.
       Shift-click and Ctrl-click are supported.

   -Path
       The path of the disk to initialize.

   -ThrottleLimit
       The maximum number of concurrent operations that can be established to run the cmdlet.

       If this parameter is omitted or a value of 0 is entered, then PowerShell will  calculate
       an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are
       running on the computer. The throttle limit applies only to the current cmdlet,
       not to the session or to the computer.

   -UniqueId
       The UniqueID of the disk to initialize.

   -VirtualDisk
       The VirtualDisk object for which you want to initialize the associated Disk object.
       The Virtual Disk CIM object is exposed by the Get-VirtualDisk cmdlet.

   -WhatIf
       Describe what would happen if you executed the command without actually
       executing the command.
 

Standard Aliases for Initialize-Disk: none

Examples

Initialize a disk using default values:

PS C:> Initialize-Disk -Number 1

Initialize a disk using the MBR partition style:

PS C:> Initialize-Disk -Number 1 -PartitionStyle MBR

Initialize a disk using the GPT partition style:

PS C:> Initialize-Disk -Number 0 -PartitionStyle GPT

Initialize a virtual disk:

PS C:> Initialize-Disk -VirtualDisk (Get-VirtualDisk -FriendlyName UserData)

“An initial condition is any member of a set of mathematical or physical values that impose starting points for the variables in an equation that has one or more arbitrary constants”

Related PowerShell Cmdlets

Mount-DiskImage - Mount a previously created disk image (virtual HD or ISO)
Clear-Disk - Remove all partition information and un-initialize a disk, erasing all data.
Equivalent bash command: $null|cat> file_to_zero.txt


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved