Mount-VHD
Mount-VHD
Mounts one or more virtual hard disks.
Syntax
Parameter Set: Default
Mount-VHD [-Path] <String[]> [-ComputerName <String[]> ] [-NoDriveLetter] [-Passthru] [-ReadOnly] [ <CommonParameters>]
Detailed Description
The Mount-VHD cmdlet mounts one or more virtual hard disks.
Parameters
-ComputerName<String[]>
Specifies one or more Hyper-V hosts on which a virtual hard disk is to be mounted. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
. |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-NoDriveLetter
Specifies that the virtual hard disk is to be mounted without assigning drive letters to the volumes contained within the virtual hard disk.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
FALSE |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Passthru
Specifies that an object is to be passed through to the pipeline representing the virtual hard disk to be mounted.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Path<String[]>
Specifies the path to the virtual hard disk file for the virtual hard disk to be mounted. If a filename or relative path is specified, the virtual hard disk path is calculated relative to the current working directory.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
true (ByValue, ByPropertyName) |
Accept Wildcard Characters? |
true |
-ReadOnly
Specifies that the virtual hard disk is to be mounted in read-only mode.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
FALSE |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1
Mounts a virtual hard disk where the path to the virtual hard disk file is c:\test\testvhdx.vhdx.
PS C:\> Mount-VHD –Path c:\test\testvhdx.vhdx
Example 2
Mounts a virtual hard disk in read-only mode where the path to the virtual hard disk file is c:\test\testvhdx.vhdx.
PS C:\> Mount-VHD –Path c:\test\testvhdx.vhdx -ReadOnly
Example 3
Attaches a virtual hard disk to the system where the path to the virtual hard disk file is c:\test\testvhdx.vhdx, and gets the volumes associated with it.
PS C:\> Mount-VHD –Path c:\test\testvhdx –PassThru | Get-Disk | Get-Partition | Get-Volume