Add-VMAssignableDevice
Adds an assignable device to a specific virtual machine.
Add-VMAssignableDevice
[-CimSession <CimSession[]>]
[-ComputerName <String[]>]
[-Credential <PSCredential[]>]
[-VMName] <String[]>
[-InstancePath <String>]
[-LocationPath <String>]
[-VirtualFunction <UInt16>]
[-ResourcePoolName <String>]
[-Passthru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-VMAssignableDevice
[-VM] <VirtualMachine[]>
[-InstancePath <String>]
[-LocationPath <String>]
[-VirtualFunction <UInt16>]
[-ResourcePoolName <String>]
[-Passthru]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
The Add-VMAssignableDevice
cmdlet assigns a physical device to a specified virtual machine (VM).
This is commonly used for tasks such as attaching GPUs or network adapters directly to a VM to
enhance performance for specific applications or workloads. The device can be specified through its
instance path, location path, or assignable device object.
Add-VMAssignableDevice -VMName "MyVM" -InstancePath "PCIROOT(0)#PCI(0300)#PCI(0000)"
This example attaches a physical device, identified by its instance path, to the virtual machine named MyVM.
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 |
Specifies one or more Hyper-V hosts on which the assignable devices are to be retrieved. 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 |
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 |
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 |
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 |
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 |
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 |
Specifies the name of the resource pool to which the device is to be assigned.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the number of the virtual function (VF) of an SR-IOV-capable network adapter assigned to the virtual machine.
Type: | UInt16 |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Specifies the virtual machine to which the device is to be assigned.
Type: | VirtualMachine[] |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Specifies the name of the virtual machine to which the device is to be assigned.
Type: | String[] |
Position: | 0 |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
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 |
Microsoft.HyperV.PowerShell.VirtualMachine[]
Microsoft.HyperV.PowerShell.VMAssignedDevice