Skip to content

Publish main to live, 07/09, 3:30 PM IST #3845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e9c7649
Updated VMHostAssignableDevice command set
Xelu86 Jun 18, 2024
196cf3a
Updated VMAssignablePartitionableGpu command set
Xelu86 Jun 18, 2024
adad7bc
Updated VMGpuPartitionAdapter command set
Xelu86 Jun 18, 2024
eb2401f
Minor edit
Xelu86 Jun 18, 2024
af6afb7
Update ComputerName description
Xelu86 Jul 3, 2024
4186c30
Applied feedback for Dismount cmdlet
Xelu86 Jul 3, 2024
ee33921
Update ComputerName for Get cmdlet
Xelu86 Jul 3, 2024
92ecded
2nd pass of VMHostAssignableDevice cmdlets
Xelu86 Jul 3, 2024
36debb2
Updated command set
Xelu86 Jul 8, 2024
ec3f12c
Updated command set
Xelu86 Jul 8, 2024
2da3da6
Updated command set
Xelu86 Jul 8, 2024
ffff4e3
Minor edit
Xelu86 Jul 8, 2024
42157ad
Removed Example 2 as it belongs to another cmdlet
Xelu86 Jul 8, 2024
a64971e
Updated command set
Xelu86 Jul 8, 2024
0f66787
Fixing indents
Xelu86 Jul 8, 2024
2c4d896
Fixing indents
Xelu86 Jul 8, 2024
df69d6c
Fixing indents
Xelu86 Jul 8, 2024
4e920c0
Updated Hyper-V cmdlet list
Xelu86 Jul 8, 2024
7a6c90a
Merge branch 'update_vmassdev' of https://github.com/Xelu86/windows-p…
Xelu86 Jul 8, 2024
fbc89c6
Merge branch 'main' into update_vmgpupartitionadapter
Xelu86 Jul 8, 2024
34abebf
Merge branch 'main' into update_vmhostassignabledevice
Xelu86 Jul 8, 2024
c4bce11
Merge branch 'main' into update_vmhostpartitionablegpu
Xelu86 Jul 8, 2024
0a47683
Merge branch 'main' into update_vmassdev
Xelu86 Jul 8, 2024
07ee109
Merge branch 'main' into update_vmhostpartgpu
Xelu86 Jul 8, 2024
ddc09c5
Merge branch 'main' into update_vmgpupartada
Xelu86 Jul 8, 2024
ae8afed
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 8, 2024
8d414e7
Merge pull request #3823 from Xelu86/update_vmgpupartitionadapter
Xelu86 Jul 8, 2024
ccd2c76
Merge branch 'main' into update_vmhostpartgpu
Xelu86 Jul 8, 2024
4f346d1
Merge branch 'main' into update_vmhostpartitionablegpu
Xelu86 Jul 8, 2024
1184ad1
Merge branch 'main' into update_vmgpupartada
Xelu86 Jul 8, 2024
d44415d
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 8, 2024
f546d15
Merge branch 'main' into update_vmassdev
Xelu86 Jul 8, 2024
cbbe674
Merge branch 'main' into update_vmhostassignabledevice
Xelu86 Jul 8, 2024
4d917b5
Merge pull request #3841 from Xelu86/update_vmhostpartgpu
Xelu86 Jul 8, 2024
49fd3d8
Merge branch 'main' into update_vmhostpartitionablegpu
Xelu86 Jul 8, 2024
6b84125
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 8, 2024
422d2c8
Merge branch 'main' into update_vmhostassignabledevice
Xelu86 Jul 8, 2024
e30f07d
Merge branch 'main' into update_vmassdev
Xelu86 Jul 8, 2024
2e938c9
Merge pull request #3822 from Xelu86/update_vmhostpartitionablegpu
Xelu86 Jul 8, 2024
0d398e7
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 8, 2024
c823759
Merge branch 'main' into update_vmgpupartada
Xelu86 Jul 8, 2024
c0833d4
Merge branch 'main' into update_vmassdev
Xelu86 Jul 8, 2024
7547438
Merge branch 'main' into update_vmhostassignabledevice
Xelu86 Jul 8, 2024
4eeec28
Merge pull request #3820 from Xelu86/update_vmhostassignabledevice
Xelu86 Jul 8, 2024
c43f887
Merge branch 'main' into update_vmassdev
Xelu86 Jul 8, 2024
fdb5b05
Merge branch 'main' into update_vmgpupartada
Xelu86 Jul 8, 2024
c11ed4b
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 9, 2024
559f93f
Merge pull request #3842 from Xelu86/update_vmgpupartada
Xelu86 Jul 9, 2024
69447d2
Merge branch 'main' into update_vmassdev
Xelu86 Jul 9, 2024
2510929
Merge branch 'main' into update_vmhostassdev
Xelu86 Jul 9, 2024
d5c42c3
Merge pull request #3844 from Xelu86/update_vmhostassdev
Xelu86 Jul 9, 2024
ac6e6f9
Merge branch 'main' into update_vmassdev
Xelu86 Jul 9, 2024
f94da72
Merge pull request #3843 from Xelu86/update_vmassdev
Xelu86 Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated command set
  • Loading branch information
Xelu86 committed Jul 8, 2024
commit 2da3da6aea34b64f521d4ab816ccda23e2f3a374
286 changes: 286 additions & 0 deletions docset/winserver2025-ps/hyper-v/Add-VMAssignableDevice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,286 @@
---
description: Assigns a device to a virtual machine.
external help file: Microsoft.HyperV.PowerShell.Cmdlets.dll-Help.xml
Module Name: Hyper-V
ms.date: 06/12/2024
online version: https://learn.microsoft.com/powershell/module/hyper-v/add-vmassignabledevice?view=windowsserver2025-ps&wt.mc_id=ps-gethelp
schema: 2.0.0
title: Add-VMAssignableDevice
---

# Add-VMAssignableDevice

## SYNOPSIS
Adds an assignable device to a specific virtual machine.

## SYNTAX

### VMName (Default)

```
Add-VMAssignableDevice [-CimSession <CimSession[]>] [-ComputerName <String[]>]
[-Credential <PSCredential[]>] [-VMName] <String[]> [-InstancePath <String>]
[-LocationPath <String>] [-VirtualFunction <UInt16>] [-ResourcePoolName <String>] [-Passthru]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

### VMObject

```
Add-VMAssignableDevice [-VM] <VirtualMachine[]> [-InstancePath <String>] [-LocationPath <String>]
[-VirtualFunction <UInt16>] [-ResourcePoolName <String>] [-Passthru] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

## DESCRIPTION

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.

## EXAMPLES

### Example 1

```powershell
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**.

### Example 2

```powershell
$gpu = Get-VMHostAssignableDevice
Add-VMHostAssignableDevice -HostAssignableDevice $gpu -ResourcePoolName "GpuChildPool"
```

This example retrieves a list of GPUs or other assignable devices and adds these devices to a
resource pool named **GpuChildPool**, making the devices available for use by virtual machines in
that resource pool.

## 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](/powershell/module/cimcmdlets/new-cimsession)
or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the
current session on the local computer.

```yaml
Type: CimSession[]
Parameter Sets: VMName
Aliases:

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

### -ComputerName

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.

```yaml
Type: String[]
Parameter Sets: VMName
Aliases:

Required: False
Position: Named
Default value: None
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.

```yaml
Type: PSCredential[]
Parameter Sets: VMName
Aliases:

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

### -InstancePath

Represents the Device Instance path in the host machine.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -LocationPath

Specifies the location path to the assignable device

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -Passthru

Returns an object for each process that the cmdlet started.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

### -ResourcePoolName

Specifies the name of the resource pool to which the device is to be assigned.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

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

### -VirtualFunction

Specifies the number of the virtual function (VF) of an SR-IOV-capable network adapter assigned to
the virtual machine.

```yaml
Type: UInt16
Parameter Sets: (All)
Aliases:

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

### -VM

Specifies the virtual machine to which the device is to be assigned.

```yaml
Type: VirtualMachine[]
Parameter Sets: VMObject
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
```

### -VMName

Specifies the name of the virtual machine to which the device is to be assigned.

```yaml
Type: String[]
Parameter Sets: VMName
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm

Prompts you for confirmation before running the cmdlet.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

### -WhatIf

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

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

### CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
-WarningAction, and -WarningVariable. For more information, see
[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters).

## INPUTS

### Microsoft.HyperV.PowerShell.VirtualMachine[]

## OUTPUTS

### Microsoft.HyperV.PowerShell.VMAssignedDevice

## NOTES

## RELATED LINKS

[Get-VMAssignableDevice](get-vmassignabledevice.md)

[Remove-VMAssignableDevice](remove-vmassignabledevice.md)
Loading