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 | Leave a 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