Replace Diskpart with PowerShell

In the new world of Powershell you can replace many of the command line utilities used by Windows Administrators. Here is a way to replace Diskpart with PowerShell commands.

1. Check if the initiator can see the disk: Get-disk

2. Select the disk to bring disk  online:

Set-disk –number 3 –IsOffline $False

3. Make disk 3 writable:

Set-disk –number 3 –isReadOnly $False

4. Initialize the disk 3:

Initialize-Disk -Number 3 -PartitionStyle MBR

5. Create a partition on disk 3 (To avoid a format volume popup in Windows Explorer, let’s not assign a drive letter at this time. We will do that after the volume is formatted)

New-Partition -DiskNumber 3 -UseMaximumSize -AssignDriveLetter:$False

6. Format volume:

Get-Partition –DiskNumber 3 | Format-Volume

7. Assign the drive letter now:

Get-Partition –DiskNumber 3 | Add-PartitionAccessPath –AssignDriveLetter:$true

Subscribe For Latest Updates

Sign up for best of digital marketing, livestream and technology opinions on what matters to you.

Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: