Skip to content

Commit ac6e6f9

Browse files
authored
Merge branch 'main' into update_vmassdev
2 parents 69447d2 + d5c42c3 commit ac6e6f9

5 files changed

+1110
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
---
2+
description: Assigns a device to a virtual machine host.
3+
external help file: Microsoft.HyperV.PowerShell.Cmdlets.dll-Help.xml
4+
Module Name: Hyper-V
5+
ms.date: 06/12/2024
6+
online version: https://learn.microsoft.com/powershell/module/hyper-v/add-vmhostassignabledevice?view=windowsserver2025-ps&wt.mc_id=ps-gethelp
7+
schema: 2.0.0
8+
title: Add-VMHostAssignableDevice
9+
---
10+
11+
# Add-VMHostAssignableDevice
12+
13+
## SYNOPSIS
14+
Adds an assignable device to a virtual machine (VM) host.
15+
16+
## SYNTAX
17+
18+
### Path (Default)
19+
20+
```
21+
Add-VMHostAssignableDevice [-CimSession <CimSession[]>] [-ComputerName <String[]>]
22+
[-Credential <PSCredential[]>] [-Force] [-InstancePath <String>] [-LocationPath <String>]
23+
-ResourcePoolName <String[]> [<CommonParameters>]
24+
```
25+
26+
### Object
27+
28+
```
29+
Add-VMHostAssignableDevice [-Force] [-HostAssignableDevice] <VMHostAssignableDevice[]>
30+
-ResourcePoolName <String[]> [<CommonParameters>]
31+
```
32+
33+
## DESCRIPTION
34+
35+
The `Add-VMHostAssignableDevice` cmdlet assigns a hardware device to a virtual machine host. You
36+
can add devices to the VM host by providing either the instance or location path of the device, or
37+
by specifying an existing host-assignable device object.
38+
39+
## EXAMPLES
40+
41+
### Example 1
42+
43+
```powershell
44+
$params = @{
45+
ComputerName = "MyVM01"
46+
InstancePath = "PCI\VEN_8086&DEV_0F48&SUBSYS_72708086&REV_0B\3&11583659&0&D8"
47+
ResourcePoolName = "MyResourcePool"
48+
}
49+
Add-VMHostAssignableDevice $params
50+
```
51+
52+
This example assigns a device identified by its instance path to VM host **MyVM01** within the
53+
resource pool **MyResourcePool**.
54+
55+
### Example 2
56+
57+
```powershell
58+
$gpu = Get-VMHostAssignableDevice
59+
Add-VMHostAssignableDevice -HostAssignableDevice $gpu -ResourcePoolName "GpuChildPool"
60+
```
61+
62+
This example retrieves a list of GPUs or other assignable devices and adds these devices to a
63+
resource pool named **GpuChildPool**, making the devices available for use by virtual machines in
64+
that resource pool.
65+
66+
## PARAMETERS
67+
68+
### -CimSession
69+
70+
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session
71+
object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession)
72+
or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the
73+
current session on the local computer.
74+
75+
```yaml
76+
Type: CimSession[]
77+
Parameter Sets: Path
78+
Aliases:
79+
80+
Required: False
81+
Position: Named
82+
Default value: None
83+
Accept pipeline input: False
84+
Accept wildcard characters: False
85+
```
86+
87+
### -ComputerName
88+
89+
Specifies the name of the Hyper-V host to which the device is to be added. NetBIOS names, IP
90+
addresses, and fully qualified domain names are allowed. The default is the local computer. Use
91+
localhost or a dot (`.`) to specify the local computer explicitly.
92+
93+
```yaml
94+
Type: String[]
95+
Parameter Sets: Path
96+
Aliases:
97+
98+
Required: False
99+
Position: Named
100+
Default value: None
101+
Accept pipeline input: False
102+
Accept wildcard characters: False
103+
```
104+
105+
### -Credential
106+
107+
Specifies one or more user accounts that have permission to perform this action. The default is the
108+
current user.
109+
110+
```yaml
111+
Type: PSCredential[]
112+
Parameter Sets: Path
113+
Aliases:
114+
115+
Required: False
116+
Position: Named
117+
Default value: None
118+
Accept pipeline input: False
119+
Accept wildcard characters: False
120+
```
121+
122+
### -Force
123+
124+
Forces the command to run without asking for user confirmation.
125+
126+
```yaml
127+
Type: SwitchParameter
128+
Parameter Sets: (All)
129+
Aliases:
130+
131+
Required: False
132+
Position: Named
133+
Default value: None
134+
Accept pipeline input: False
135+
Accept wildcard characters: False
136+
```
137+
138+
### -HostAssignableDevice
139+
140+
Specifies the device object to be assigned to the virtual machine.
141+
142+
```yaml
143+
Type: VMHostAssignableDevice[]
144+
Parameter Sets: Object
145+
Aliases: VMHostAssignableDevice
146+
147+
Required: True
148+
Position: 0
149+
Default value: None
150+
Accept pipeline input: True (ByValue)
151+
Accept wildcard characters: False
152+
```
153+
154+
### -InstancePath
155+
156+
Represents the Device Instance path in the host machine.
157+
158+
```yaml
159+
Type: String
160+
Parameter Sets: Path
161+
Aliases:
162+
163+
Required: False
164+
Position: Named
165+
Default value: None
166+
Accept pipeline input: False
167+
Accept wildcard characters: False
168+
```
169+
170+
### -LocationPath
171+
172+
Specifies the location path to the assignable device.
173+
174+
```yaml
175+
Type: String
176+
Parameter Sets: Path
177+
Aliases:
178+
179+
Required: False
180+
Position: Named
181+
Default value: None
182+
Accept pipeline input: False
183+
Accept wildcard characters: False
184+
```
185+
186+
### -ResourcePoolName
187+
188+
Specifies the name of the resource pool to which the device is assigned.
189+
190+
```yaml
191+
Type: String[]
192+
Parameter Sets: (All)
193+
Aliases:
194+
195+
Required: True
196+
Position: Named
197+
Default value: None
198+
Accept pipeline input: False
199+
Accept wildcard characters: False
200+
```
201+
202+
### CommonParameters
203+
204+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
205+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
206+
-WarningAction, and -WarningVariable. For more information, see
207+
[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters).
208+
209+
## INPUTS
210+
211+
### Microsoft.HyperV.PowerShell.VMHostAssignableDevice[]
212+
213+
## OUTPUTS
214+
215+
### System.Object
216+
217+
## NOTES
218+
219+
## RELATED LINKS
220+
221+
[Get-VMHostAssignableDevice](get-vmhostassignabledevice.md)
222+
223+
[Dismount-VMHostAssignableDevice](dismount-vmhostassignabledevice.md)
224+
225+
[Mount-VMHostAssignableDevice](mount-vmhostassignabledevice.md)
226+
227+
[Remove-VMHostAssignableDevice](remove-vmhostassignabledevice.md)

0 commit comments

Comments
 (0)