Category Archives: Storage

Diskpart and PowerShell – part4: Remove a partition

So far you’ve seen how to create and modify partitions and volumes. Its now time to look at how you remove a partition. Mount the test VHD Get-VHD -Path C:\test\Test1.vhdx | Mount-VHD You can’t remove a volume – you have … Continue reading

Posted in Powershell, Storage | Leave a comment

Diskpart and PowerShell–part 4: Expand a volume

Let’s create a new disk and mount it New-VHD -Path C:\test\Test1.vhdx -Dynamic -SizeBytes 20GB Get-VHD -Path C:\test\Test1.vhdx | Mount-VHD Initialize-Disk -Number 1 This time we’ll create a volume that only uses part of the disk New-Partition -DiskNumber 1 -DriveLetter F … Continue reading

Posted in Powershell, Storage | Leave a comment

Mass dismount VHDs

I’m going to be creating, using and discarding a number of VHDs for my diskpart and PowerShell series. When I have a number of them mounted I want a quick way to dismount them. Assuming I consistently keep them in … Continue reading

Posted in Powershell, Storage | Leave a comment

Diskpart and PowerShell–part 3: Initialize disk and create volume

Last time we created a virtual disk and mounted it. In this post we’ll initialize the disk and create a volume. Start by remounting the disk Get-VHD -Path C:\test\Test1.vhdx | Mount-VHD You can now initialize the disk: Initialize-Disk -Number 1 … Continue reading

Posted in Powershell, Storage | Leave a comment

Diskpart and PowerShell–part 2: Create a virtual disk

Before we start digging into the diskpart/Storage module functionality we need a disk to practice on. I don’t recommend using your machine’s system disk – bad things will happen. The Hyper-V module has  a New-VHD cmdlet so lets use that … Continue reading

Posted in Powershell, Storage | Leave a comment