Powershell – Set up disk volume from scratch using Initialize-Disk, Get-Disk, New-Partition and Format Volume

You may wish to script the process of setting up a disk volume.

The example in this post covers initializing the disk using GPT, creating the partition using the maximum size on the disk, and then formatting the partition using NTFS.


  1. GPT – GUID partition table (GPT) is required for disks larger than 2 terabytes.
  2. NTFS – New Technology File System (NTFS) is the file system used on modern Windows Operating Systems.
  3. I believe these commandlets are available to Windows 8, Windows 2012 and above.

Code description

  1. You specify the disk number that requires initialization in $DiskNumber
  2. You specify the desired volume name in $VolumeName
  3. The disk is initialized and set to use the GPT partition style
  4. The disk has a partition created on it using all available storage, and gives it the volume name
  5. The volume is formatted using the NTFS file system and given a label of “Data”


$DiskNumber = 1
$VolumeName = "E:\"

Initialize-Disk -Number $DiskNumber -PartitionStyle GPT

Get-Disk -Number $DiskNumber | New-Partition -UseMaximumSize -DriveLetter $VolumeName

Format-Volume -DriveLetter $VolumeName -FileSystem NTFS -NewFileSystemLabel "Data"



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s