Upravit

Sdílet prostřednictvím


Mount-VMHostAssignableDevice

Mounts a device to a virtual machine (VM) host.

Syntax

Mount-VMHostAssignableDevice
     [-CimSession <CimSession[]>]
     [-ComputerName <String[]>]
     [-Credential <PSCredential[]>]
     [-InstancePath <String>]
     [-LocationPath <String>]
     [-Passthru]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]
Mount-VMHostAssignableDevice
     [-HostAssignableDevice] <VMHostAssignableDevice[]>
     [-Passthru]
     [-WhatIf]
     [-Confirm]
     [<CommonParameters>]

Description

The Mount-VMHostAssignableDevice cmdlet mounts a device such as GPUs, network adapters, or storage controllers that are physically present on the virtual machine host.

Examples

Example 1

$device = Get-VMHostAssignableDevice -InstancePath "PCIROOT(0)#PCI(0300)#PCI(0000)"
$params = @{
HostAssignableDevice = $device
VMName = "MyVM"
}
Mount-VMHostAssignableDevice @params

In this example, the Get-VMHostAssignableDevice cmdlet retrieves the device with the specified instance path and stores it in the $device variable. The Mount-VMHostAssignableDevice cmdlet then assigns this device to the virtual machine named MyVM.

Parameters

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Type:CimSession[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ComputerName

Specifies one or more Hyper-V hosts from which the assignable devices are to be mounted. NetBIOS names, IP addresses, and fully qualified domain names are allowed. The default is the local computer. Use localhost or a dot (.) to specify the local computer explicitly.

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Type:PSCredential[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HostAssignableDevice

Specifies the assignable device to be mounted on the virtual machine host.

Type:VMHostAssignableDevice[]
Aliases:VMHostAssignableDevice
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-InstancePath

Represents the Device Instance path in the host machine.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-LocationPath

Specifies the location path to the assignable device.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Passthru

Returns an object for each process that the cmdlet started.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.HyperV.PowerShell.VMHostAssignableDevice[]

Outputs

Microsoft.HyperV.PowerShell.VMHostAssignableDevice