PowerShell Logo Small

Get-VHD



This is the built-in help made by Microsoft for the command 'Get-VHD', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Gets the virtual hard disk object associated with a virtual hard disk.

SYNTAX


Get-VHD [-Path] <String[]> [-ComputerName <String[]>] [<CommonParameters>]
Get-VHD [-DiskNumber] <UInt32> [-ComputerName <String[]>] [<CommonParameters>]
Get-VHD [-VMId] <Guid[]> [-ComputerName <String[]>] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Get-VHD cmdlet gets the virtual hard disk object associated with a virtual hard disk.



<

RELATED LINKS


Online Version: http://go.microsoft.com/fwlink/?LinkID=306844

REMARKS

<

Examples


Example 1

PS C:\>Get-VHD –Path c:\test\testvhdx.vhdx



Gets the virtual hard disk where the path to the virtual hard disk file is c:\test\testvhdx.vhdx.




Example 2

PS C:\>Get-VHD –DiskNumber 6



Gets the virtual hard disk attached to the system with disk number 6.




Example 3

PS C:\>Get-VM -VMName TestVM | Select-Object VMId | Get-VHD



Gets the virtual hard disk objects associated with virtual machine TestVM, using the pipeline feature for the VMId parameter.




Example 4

PS C:\>Get-VM –VMName testvm | Select-Object vmid | Get-VHD



Gets the virtual hard disk objects associated with virtual machine testvm using the pipeline feature for the path parameter.




Example 5

PS C:\>Get-ChildItem c:\test –Recurse |% {$_.FullName} | Get-VHD –ErrorAction SilentlyContinue



Gets the virtual hard disk object for all the virtual hard disk files that are contained in the specified directory and its subdirectories.