Category Archives: Storage

More diskinfo

Yesterday I showed how to get the disk, partition and logical disk information using CIM. Today I want to show more diskinfo techniques. This time we’ll use the Storage module which was introduced with Windows 8. Underneath the covers it … Continue reading

Posted in PowerShell and CIM, Storage | Leave a comment

Linking disks, partitions and logical drives

A question of the forums was asking about discovering disk information. They were trying to pipe the output of Get-WmiObject into another Get-WmiObject. that won’t work. There is another way. On Windows machines physical drives are divided into 1 or … Continue reading

Posted in PowerShell and CIM, PowerShell and WMI, Storage | 1 Comment

Get-PhysicalDisk options

These are the Get-PhysicalDisk options for identifying the disk you want -UniqueId <string> -ObjectId <string> -FriendlyName <string> -InputObject <CimInstance#MSFT_PhysicalDisk> -StorageSubsystem <CimInstance#MSFT_StorageSubsystem> -StorageEnclosure <CimInstance#MSFT_StorageEnclosure> -StorageNode <CimInstance#MSFT_StorageNode> -StoragePool <CimInstance#MSFT_StoragePool> -VirtualDisk <CimInstance#MSFT_VirtualDisk> When dealing with disks installed in the machine then the friendly … Continue reading

Posted in Powershell, Storage | Leave a comment

Diskpart and PowerShell – part 6: Multiple partitions on a disk

So far we’ve looked at creating a single partition on a disk. This time we’ll look at how you can create multiple partitions on a disk. The are good reasons not to do this but its something I’ve seen done … Continue reading

Posted in Powershell, Storage | Leave a comment

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