Monday, February 24, 2014

PowerShell to seach Hyper-V VM Hard Disks for a specific VHD/VHDX file path

Sometimes people may not always place the VHD/VHDX files in the path your expecting them to be which if this is on a different partition it could cause some administrative overhead when managing the disk space on your host server. I was faced with this problem and came up with the following little PowerShell script to help search all VMs for an attached disk with the path of the VHD file I found.

$VHDToFind = Read-Host "Enter the Full Path to the VHD that you want to search for?"
Get-VM | ForEach-Object {$vmHDD = Get-VMHardDiskDrive -VMName $_.Name; if ($vmHDD.Path -EQ $VHDToFind) {Write-Host "VHD attached to $($vmHDD.VMName)" -ForegroundColor Green;}}


  1. The Longines, replica longines ukLa Grande Classique series features a stainless steel 24mm case, with a fixed bezel, replica longines conquest mens watches a blue dial and a scratch resistant sapphire crystal.This beautiful wristwatch, powered by a Longines Calibre 209, Swiss quartz movement, supporting: hour, minute functions.This watch has a water resistance of up to 100 feet/30 meters, suitable for short periods of recreational swimming.This stylish Swiss-made timepiece is sure to complete any man's collection.

  2. Now designed by Mr McQueen’s long-time collaborator, replica boots Ms Sarah Burton, Alexander McQueen collections are characterised by replica alexander mcqueen immaculate tailoring and a dark, dramatic edge. Look out for sharp suiting and the label's signature skulls.

  3. Renowned for their red-lacquered soles,replica louboutin uk Christian Louboutin shoes bring luxury replica women louboutin boots footwear to daring new heights. No matter the event, Louboutin shoes exude glamour and an unrivaled appeal. Discover statement-making Louboutin heels like the So Kate, Pigalle, chic printed flats, and more unique styles.

  4. No outfit is complete without the perfect pair of shoes,cheap giuseppe zanotti shoes and it's not always cheap man giuseppe zanotti shoes easy to find them. But with this exceptional range by Giuseppe Zanotti, that's a thing of the past. An elaborate and sometimes wild journey into eccentric design choices,cheap man giuseppe zanotti shoes this collection of shoes is for all those who want to really try something new. The base shoes themselves hark back to classic designs 'sneakers, ankle boots, and so on 'but the detailing is something that's all its own. You'll find buckles, straps, fringes and much more on many of the pieces in the Giuseppe Zanotti range 'but there are also several pieces with an understated charm, too. Are you a wild one or a little more reserved? With this collection, both schools are catered for.