In this post you will learn how to perform various disk management tasks with PowerShell. I will explain how to list disks, format disks, initialize disks, and create and delete volumes and partitions.

Latest posts by Prateek Singh (see all)

List disks ^

Before you can begin configuring and managing your Windows Server storage, you first need to fetch the list of disks presented on the machine using PowerShell.

List disks with PowerShell

List disks with PowerShell

Format a disk ^

Having new disks present on the server is a totally different case, but there may be scenarios where you want to format existing disks and then create partitions and volumes. You can use the Clear-Disk cmdlet to remove all partition information and uninitialize it, which will erase the data on the disk.

This is an unrecoverable process, so please make sure to back up your disk before running the command.

Disks can contain both data and OEM partitions, and you can very easily remove them from the disk using the switch parameters -RemoveData and -RemoveOEM.

Initialize a disk ^

A new disk or a cleaned disk using the cmdlet mentioned above is in an uninitialized state, and you have to initialize it first using the disk number of the target disk.

By default, this initializes all disks as GUID Partition Tables (GPTs) unless explicitly specified, and you can use the ‑PartitionStyle parameter to initialize a disk as a Master Boot Record (MBR).

If the disk has recently just become present on the server, it will be in a raw partition style state. You can easily target and initialize such disks using the following command:

Initialize the disk

Initialize the disk

Create a partition and volume ^

To create a partition, which is basically a block of data on the disk, you can run the New-Partition cmdlet with the ‑AssignDriveLetter and ‑UseMaximumSize switches to choose the available and allowed drive letter with the maximum size available on the disk.

You can also explicitly specify the disk size and drive letter.

Creating new partitions

Creating new partitions

After partitioning the disks, you can list them to see the current status:

Getting the partitions

Getting the partitions

After creating the partitions, they are still not accessible from the File Explorer. You have to create new volumes in a format (like NTFS) that the operating system understands.

Format the volumes

Format the volumes

Delete a partition ^

To delete any partition on a disk, you can target it with the disk number and then pipe it to the Remove-Partition cmdlet

Deleting partitions

Deleting partitions

Conclusion ^

After presenting a storage disk on a Windows machine, it is very easy to initialize raw disks and bring them online using PowerShell. With just a few PowerShell cmdlets, you can also create partitions and volumes so they're accessible through the file system.

Managing storage with PowerShell

Managing storage with PowerShell

Join the 4sysops PowerShell group!

Your question was not answered? Ask in the forum!


Users who have LIKED this post:

  • avatar
  • avatar
  • avatar
  1. Malte Schröder 1 year ago

    # List disks that are not system disks

    # to avoid accidently formatting your system drive

    Get-Disk | Where-Object IsSystem -eq $True

    Please change this to $False


    Users who have LIKED this comment:

    • avatar
  2. everson 1 year ago

    thanks so much for this post


  3. Mark Heath 10 months ago

    I'm trying to change a USB drive format from GPT to MBR (as my media player doesn't recognise GPT) I've tried Clear-Disk and Reset-Physicaldisk but Initilize-Disk keeps telling me that the disk is already initialized, how do I fix this?


    • Use 

      Then you can initialize it again.


      • Mark 10 months ago

        I mentioned that I had done a Clear-Disk. I tried multiple options, none had removed the partition table.  I had to resort to using diskpart and interactively selecting the disk and performing a clean.

        I don't suppose anyone knows why Clear-disk did not work?


        • Mark, I know you mentioned it. Thats why I tested it and it only did the desired job after adding the -RemoveOEM parameter. After that I was able to Initialize again. Would not advice something that I havent tried 🙂

          Why it doesnt work for you is hard to say .


  4. Mark Heath 10 months ago

    what do I do to get to the bottom of this error?


    • I just added a new disk to Win 2012 R2, Initialized it, cleared with Clear-disk and then I can initialize it again.

      Can you check Disk Management GUI after you do clear-disk and confirm? The disk should go to Unknown status with red arrow down.

      I suggest to open a topic on PS Forum if you need further help.


      Users who have LIKED this comment:

      • avatar
    • @Mark

      Did you check if your USB drive is not write-protected?


      • Mark Heath 4 months ago

        err yes because this was the get-volume before the clear-disk. But shouldn't clear-disk report an error if that was the case?

        And this is it after the clear-disk

        I am looking for a way to change the partition type from MBR to GPT.

        Thanks for your time.


  5. Christian Muehter 5 months ago

    I am using terraform and building a server with 6 drives not initialized, online or formatted.


    is there a way to do all that and assign drive letters using the full available space for each disk?


  6. Taha 4 months ago

    can you please show me a way to check following problems via powershell

    1.Check Storage Free Capacity and if not > 30% on all the Volumes it should send mail

    2 Check Data Transfer Rate between Volumes and if < 120 MB/s at any given time it should send mail  


  7. HImanshuPathak 3 weeks ago

    Bro these codes are not working in WINPE mode.

    I have powershell support added in my winpe, all commands are working fine, but this clearing disk and volume are not working.


    Please assist


Leave a reply

Your email address will not be published. Required fields are marked *


© 4sysops 2006 - 2020


Please ask IT administration questions in the forums. Any other messages are welcome.


Log in with your credentials


Forgot your details?

Create Account