{"id":2491,"date":"2012-09-14T11:37:07","date_gmt":"2012-09-14T15:37:07","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2491"},"modified":"2013-08-09T08:53:39","modified_gmt":"2013-08-09T12:53:39","slug":"hyper-v-vhd-summary","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/","title":{"rendered":"Hyper-V VHD Summary"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png\" alt=\"\" title=\"computereye\" width=\"150\" height=\"150\" class=\"alignleft size-thumbnail wp-image-2165\" \/><\/a>When I made the move to Windows 8, one of my tasks was to migrate my test environment from VirtualBox to Hyper-V. Windows 8 includes a client Hyper-V feature that is easy to use and includes PowerShell support. Plus I needed to expand my Hyper-V skills anyway, especially from the console. After setting up a number of VMs, I realized I needed to get a handle on disks: what files were in use for which VM? The Get-VM cmdlet writes a VirtualMachine object to the pipeline. One of its properties is HardDrives.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\&gt; $vm = get-vm \"XP Lab\"\r\nPS S:\\&gt; $vm.GetType().Name\r\nVirtualMachine\r\nPS S:\\&gt; $vm | select *\r\n\r\n\r\nVMName                      : XP Lab\r\nVMId                        : da416538-7a72-4b57-b08d-7780d81745b6\r\nId                          : da416538-7a72-4b57-b08d-7780d81745b6\r\nName                        : XP Lab\r\nState                       : Off\r\nOperationalStatus           : {Ok}\r\nPrimaryOperationalStatus    : Ok\r\nSecondaryOperationalStatus  : \r\nStatusDescriptions          : {Operating normally}\r\nPrimaryStatusDescription    : Operating normally\r\nSecondaryStatusDescription  : \r\nStatus                      : Operating normally\r\nHeartbeat                   : \r\nReplicationState            : Disabled\r\nReplicationHealth           : NotApplicable\r\nReplicationMode             : None\r\nCPUUsage                    : 0\r\nMemoryAssigned              : 0\r\nMemoryDemand                : 0\r\nMemoryStatus                : \r\nSmartPagingFileInUse        : False\r\nUptime                      : 00:00:00\r\nIntegrationServicesVersion  : \r\nResourceMeteringEnabled     : False\r\nConfigurationLocation       : C:\\ProgramData\\Microsoft\\Windows\\Hyper-V\r\nSnapshotFileLocation        : C:\\ProgramData\\Microsoft\\Windows\\Hyper-V\r\nAutomaticStartAction        : StartIfRunning\r\nAutomaticStopAction         : Save\r\nAutomaticStartDelay         : 0\r\nSmartPagingFilePath         : C:\\ProgramData\\Microsoft\\Windows\\Hyper-V\r\nNumaAligned                 : \r\nNumaNodesCount              : 1\r\nNumaSocketCount             : 1\r\nIsDeleted                   : False\r\nComputerName                : SERENITY\r\nNotes                       : \r\nPath                        : C:\\ProgramData\\Microsoft\\Windows\\Hyper-V\r\nCreationTime                : 8\/20\/2012 5:43:38 PM\r\nIsClustered                 : False\r\nSizeOfSystemFiles           : 29366\r\nParentSnapshotId            : \r\nParentSnapshotName          : \r\nMemoryStartup               : 536870912\r\nDynamicMemoryEnabled        : False\r\nMemoryMinimum               : 536870912\r\nMemoryMaximum               : 1099511627776\r\nProcessorCount              : 1\r\nRemoteFxAdapter             : \r\nNetworkAdapters             : {Network Adapter}\r\nFibreChannelHostBusAdapters : {}\r\nComPort1                    : Microsoft.HyperV.PowerShell.VMComPort\r\nComPort2                    : Microsoft.HyperV.PowerShell.VMComPort\r\nFloppyDrive                 : Microsoft.HyperV.PowerShell.VMFloppyDiskDrive\r\nDVDDrives                   : {DVD Drive on IDE controller number 1 at location 0}\r\nHardDrives                  : {Hard Drive on IDE controller number 0 at location 0}\r\nVMIntegrationService        : {Time Synchronization, Heartbeat, Key-Value Pair Exchange, Shutdown...}\r\n<\/pre>\n<p>The property is actually a nested object.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $vm.HardDrives\r\n\r\nVMName ControllerType ControllerNumber ControllerLocation DiskNumber Path\r\n------ -------------- ---------------- ------------------ ---------- ----\r\nXP Lab IDE            0                0                             D:\\VHD\\XPLab.vhd\r\n<\/pre>\n<p>That tells me where the VHD is, but not about it. For that I can use Get-VHD.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $vm.HardDrives | Get-VHD\r\n\r\nComputerName            : SERENITY\r\nPath                    : D:\\VHD\\XPLab.vhd\r\nVhdFormat               : VHD\r\nVhdType                 : Dynamic\r\nFileSize                : 8709523456\r\nSize                    : 10737418240\r\nMinimumSize             : 10725765120\r\nLogicalSectorSize       : 512\r\nPhysicalSectorSize      : 512\r\nBlockSize               : 2097152\r\nParentPath              :\r\nFragmentationPercentage : 0\r\nAlignment               : 0\r\nAttached                : False\r\nDiskNumber              :\r\nIsDeleted               : False\r\nNumber                  :\r\n<\/pre>\n<p>There is some great information here like sizes, type and format. All I need now is a way to combine all of this information so that for every VM I can get a summary of pertinent VHD information. This is a great scenario for using Select-Object and creating a custom property.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\n$vm.HardDrives | Select VMName,Path,@{Name=\"Size\";Expression={ (Get-VHD $_.path).Size}}\r\n\r\nVMName                           Path                                                Size\r\n------                           ----                                                ----\r\nXP Lab                           D:\\VHD\\XPLab.vhd                             10737418240\r\n<\/pre>\n<p>In the hash table, the Expression script block is running Get-VHD and returning the Size property. Eventually I want this for all VMs which means I'll need to expand the HardDrives property.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\n$vm | select -expandproperty HardDrives | Select VMName,Path,@{Name=\"Size\";Expression={ (Get-VHD $_.path).Size}}, @{Name=\"FileSize\";Expression={(Get-VHD $_.path).FileSize}}\r\n\r\nVMName                  Path                                  Size                       FileSize\r\n------                  ----                                  ----                       --------\r\nXP Lab                  D:\\VHD\\XPLab.vhd               10737418240                     8709523456\r\n<\/pre>\n<p>That is very promising. In fact, let's cut to the chase.<\/p>\n<pre lang:ps decode:true \" >\r\n#requires -version 3.0\r\n\r\nFunction Get-VHDSummary {\r\n\r\n<#\r\n.Synopsis\r\nGet Hyper-V VHD Information\r\n.Description\r\nGet a summary report of all associated VHDs with their respective virtual\r\nmachines. This requires the Hyper-V PowerShell module.\r\n.Example\r\nPS C:\\> Get-VHDSummary\r\n\r\nVMName     : CHI-Client02\r\nPath       : D:\\VHD\\Win7_C.vhd\r\nType       : Dynamic\r\nFormat     : VHD\r\nSizeGB     : 25\r\nFileSizeGB : 21\r\n\r\nVMName     : CHI-Client02\r\nPath       : C:\\Users\\Public\\Documents\\Hyper-V\\Virtual Hard Disks\\CHI-Client2-Swap.vhdx\r\nType       : Dynamic\r\nFormat     : VHDX\r\nSizeGB     : 4\r\nFileSizeGB : 1\r\n\r\nVMName     : Win2012-01\r\nPath       : D:\\VHD\\Win2012-01_340B1F8F-FFFB-4DCD-9B3A-7819D8BCE3C2.avhdx\r\nType       : Differencing\r\nFormat     : VHDX\r\nSizeGB     : 40\r\nFileSizeGB : 2\r\n\r\n.Example\r\nPS C:\\> get-vhdsummary | sort Type | format-table -GroupBy Type -Property VMName,Path,*Size*\r\n.Example\r\nPS C:\\> get-vhdsummary | Copy-item -destination Z:\\VHDBackup\r\n.Example\r\nPS C:\\> get-vhdsummary | measure-object -property FilesizeGB -sum\r\n.Link\r\nGet-VM\r\nGet-VHD\r\n#>\r\n\r\nParam()\r\n\r\nGet-VM  | Select-Object -expandproperty harddrives | \r\nSelect-Object -property VMName,Path,\r\n@{Name=\"Type\";Expression={(Get-VHD -Path $_.Path).VhdType}},\r\n@{Name=\"Format\";Expression={(Get-VHD -Path $_.Path).VhdFormat}},\r\n@{Name=\"SizeGB\";Expression={((Get-VHD -Path $_.Path).Size)\/1GB -as [int]}},\r\n@{Name=\"FileSizeGB\";Expression={((Get-VHD -Path $_.Path).FileSize)\/1GB -as [int]}}\r\n\r\n} #end function\r\n<\/pre>\n<p>This function writes a summary object for each VM which means I can further sort, filter or whatever I need to do. Because this can take a bit of time to run, I'll save the results to a variable.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $summary = get-vhdsummary\r\n<\/pre>\n<p>One unexpected bonus was that it helped me identify a VM with a \"bad\" VHD reference.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $summary | where {-Not $_.type}\r\n\r\nVMName     : Windows Server 2012 VHD Boot\r\nPath       : C:\\Win8BetaServer.vhd\r\nType       :\r\nFormat     :\r\nSizeGB     : 0\r\nFileSizeGB : 0\r\n<\/pre>\n<p>This was a file I had renamed, which \"broke\" the virtual machine. Or I can see how much space my VHD files are taking.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $summary  | measure FileSizeGB -sum\r\n\r\nCount    : 18\r\nAverage  :\r\nSum      : 102\r\nMaximum  :\r\nMinimum  :\r\nProperty : FileSizeGB\r\n<\/pre>\n<p>Or perhaps I need to back them all up.<\/p>\n<pre class=\"nums:false lang:batch decode:true \" >\r\nPS S:\\> $summary | copy -dest g:\\vhd-backup -whatif\r\nWhat if: Performing operation \"Copy File\" on Target \"Item: D:\\VHD\\Win7_C.vhd Destination: G:\\vhd-backup\\Win7_C.vhd\".\r\n...\r\n<\/pre>\n<p>Awesome. But.....my function is based on code I developed to run from the command line which works great as a one line command. I'm not likely to have a great number of virtual machines so performance isn't that big a deal. Plus I could always run it as a job. If I'm going to turn this into a function, perhaps it makes sense to break this up.<\/p>\n<p>If you look at my function, I'm running Get-VHD multiple times for the same file. It probably makes more sense to only get it once. Here's a revised block of code.<\/p>\n<pre lang:ps decode:true \" >\r\nFunction Get-VHDSummary2 {\r\nParam()\r\n\r\n#get all virtual machines\r\n$vms=Get-VM\r\n\r\nforeach ($vm in $vms) {\r\n  Write-Host \"Getting drive info from $($vm.name)\" -foregroundcolor Cyan\r\n  #get the hard drives foreach virtual machine\r\n  $vm.HardDrives | foreach-object {\r\n      #a VM might have multiple drives so for each one get the VHD\r\n      $vhd=Get-VHD -path $_.path\r\n\r\n      <#\r\n       $_ is the hard drive object so select a few properties and\r\n       include properties from the VHD\r\n      #>\r\n      $_ | Select-Object -property VMName,Path,\r\n        @{Name=\"Type\";Expression={$vhd.VhdType}},\r\n        @{Name=\"Format\";Expression={$vhd.VhdFormat}},\r\n        @{Name=\"SizeGB\";Expression={($vhd.Size)\/1GB -as [int]}},\r\n        @{Name=\"FileSizeGB\";Expression={($vhd.FileSize)\/1GB -as [int]}}\r\n } #foreach\r\n} #foreach vm\r\n\r\n} #close function\r\n<\/pre>\n<p>I'll get the same result, and actually faster. My first version took 7.8 seconds and this takes 2.3 seconds. Because this is a function, I only have to type it once so I can add comments and even a progress message with Write-Host. This isn't too say I can't do this all from the console; it is just a bit more tedious.<\/p>\n<p>The purpose of my post is to not only demonstrate some of the Hyper-V cmdlets, but also that what you type at the console doesn't always make the best PowerShell script. Sometimes you need to re-think things for performance and maintainability.<\/p>\n<p>Download <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/09\/Get-VHDSummary.txt'>Get-VHDSummary<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I made the move to Windows 8, one of my tasks was to migrate my test environment from VirtualBox to Hyper-V. Windows 8 includes a client Hyper-V feature that is easy to use and includes PowerShell support. Plus I needed to expand my Hyper-V skills anyway, especially from the console. After setting up a&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[401,4,8],"tags":[573,534,540,402,403],"class_list":["post-2491","post","type-post","status-publish","format-standard","hentry","category-hyper-v","category-powershell","category-scripting","tag-hyper-v","tag-powershell","tag-scripting","tag-vhd","tag-virtualization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Hyper-V VHD Summary &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hyper-V VHD Summary &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"When I made the move to Windows 8, one of my tasks was to migrate my test environment from VirtualBox to Hyper-V. Windows 8 includes a client Hyper-V feature that is easy to use and includes PowerShell support. Plus I needed to expand my Hyper-V skills anyway, especially from the console. After setting up a...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2012-09-14T15:37:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-08-09T12:53:39+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Hyper-V VHD Summary\",\"datePublished\":\"2012-09-14T15:37:07+00:00\",\"dateModified\":\"2013-08-09T12:53:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/\"},\"wordCount\":513,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/computereye-150x150.png\",\"keywords\":[\"Hyper-V\",\"PowerShell\",\"Scripting\",\"VHD\",\"Virtualization\"],\"articleSection\":[\"Hyper-V\",\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/\",\"name\":\"Hyper-V VHD Summary &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/computereye-150x150.png\",\"datePublished\":\"2012-09-14T15:37:07+00:00\",\"dateModified\":\"2013-08-09T12:53:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/computereye.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2012\\\/04\\\/computereye.png\",\"width\":\"896\",\"height\":\"1024\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2491\\\/hyper-v-vhd-summary\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Hyper-V\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/hyper-v\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hyper-V VHD Summary\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hyper-V VHD Summary &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/","og_locale":"en_US","og_type":"article","og_title":"Hyper-V VHD Summary &#8226; The Lonely Administrator","og_description":"When I made the move to Windows 8, one of my tasks was to migrate my test environment from VirtualBox to Hyper-V. Windows 8 includes a client Hyper-V feature that is easy to use and includes PowerShell support. Plus I needed to expand my Hyper-V skills anyway, especially from the console. After setting up a...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/","og_site_name":"The Lonely Administrator","article_published_time":"2012-09-14T15:37:07+00:00","article_modified_time":"2013-08-09T12:53:39+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Hyper-V VHD Summary","datePublished":"2012-09-14T15:37:07+00:00","dateModified":"2013-08-09T12:53:39+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/"},"wordCount":513,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png","keywords":["Hyper-V","PowerShell","Scripting","VHD","Virtualization"],"articleSection":["Hyper-V","PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/","name":"Hyper-V VHD Summary &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye-150x150.png","datePublished":"2012-09-14T15:37:07+00:00","dateModified":"2013-08-09T12:53:39+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/04\/computereye.png","width":"896","height":"1024"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2491\/hyper-v-vhd-summary\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Hyper-V","item":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},{"@type":"ListItem","position":2,"name":"Hyper-V VHD Summary"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":2546,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/2546\/powershell-hyper-v-memory-report\/","url_meta":{"origin":2491,"position":0},"title":"PowerShell Hyper-V Memory Report","author":"Jeffery Hicks","date":"November 1, 2012","format":false,"excerpt":"Since moving to Windows 8, I've continued exploring all the possibilities around Hyper-V on the client, especially using PowerShell. Because I'm trying to run as many virtual machines on my laptop as I can, memory considerations are paramount as I only have 8GB to work with. Actually less since I\u2026","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/11\/happyreport-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4457,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4457\/creating-a-hyper-v-vm-memory-report\/","url_meta":{"origin":2491,"position":1},"title":"Creating a Hyper-V VM Memory Report","author":"Jeffery Hicks","date":"July 20, 2015","format":false,"excerpt":"I use Hyper-V to run my lab environment. Since I work at home I don't have access to a \"real\" production network so I have to make do with a virtualized environment. Given budgetary constraints I also don't have a lot of high end hardware with endless amount of RAM\u2026","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2566,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2566\/importing-hyper-v-vm-from-a-powershell-backup\/","url_meta":{"origin":2491,"position":2},"title":"Importing Hyper-V VM from a PowerShell Backup","author":"Jeffery Hicks","date":"November 5, 2012","format":false,"excerpt":"My Petri article this week is on importing Hyper-V VMs from a backup. http:\/\/bit.ly\/PRE0pk I have many more articles on Hyper-V on Windows 8 on the site as well. You can find all of my recent posts here.","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2657,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2657\/hyper-v-id-hash-table\/","url_meta":{"origin":2491,"position":3},"title":"Hyper-V ID Hash Table","author":"Jeffery Hicks","date":"January 3, 2013","format":false,"excerpt":"In Hyper-V, one of the challenges (at least that I've run into) has to do with naming. In addition to a name, Hyper-V objects such as virtual machines, are identified with a GUID. Most of the VM-related PowerShell cmdlets will let you specify a virtual machine name. But sometimes you'll\u2026","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"Microsoft Hyper-V","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/hyperv.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":4685,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4685\/adding-some-power-to-hyper-v-vm-notes\/","url_meta":{"origin":2491,"position":4},"title":"Adding Some Power to Hyper-V VM Notes","author":"Jeffery Hicks","date":"December 15, 2015","format":false,"excerpt":"I use they Hyper-V virtual machine note to store system information. Here's how I get it and set with PowerShell.","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"System Information","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/12\/image_thumb-1.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3371,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-3-0\/3371\/hyper-v-waiting-to-merge\/","url_meta":{"origin":2491,"position":5},"title":"Hyper-V Waiting to Merge","author":"Jeffery Hicks","date":"August 28, 2013","format":false,"excerpt":"In my Hyper-V environment I have a test domain which I use for pretty much all of my training, writing and video work. As part of my \"belt and suspenders\" approach, I periodically take a snapshot of all the virtual machines using the theory that if I had to, I\u2026","rel":"","context":"In &quot;Hyper-V&quot;","block_context":{"text":"Hyper-V","link":"https:\/\/jdhitsolutions.com\/blog\/category\/hyper-v\/"},"img":{"alt_text":"Microsoft Hyper-V","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/01\/hyperv.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2491","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2491"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2491\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2491"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2491"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2491"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}