Skip to content

Commit 207ec12

Browse files
authored
Merge pull request MicrosoftDocs#3821 from Xelu86/update_vmassignabledevice
Update VMAssignableDevice command set - WS22
2 parents 4f1f77e + 8e97d27 commit 207ec12

File tree

4 files changed

+738
-4
lines changed

4 files changed

+738
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
---
2+
description: Assigns a device to a virtual machine.
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-vmassignabledevice?view=windowsserver2022-ps&wt.mc_id=ps-gethelp
7+
schema: 2.0.0
8+
title: Add-VMAssignableDevice
9+
---
10+
11+
# Add-VMAssignableDevice
12+
13+
## SYNOPSIS
14+
Adds an assignable device to a specific virtual machine.
15+
16+
## SYNTAX
17+
18+
### VMName (Default)
19+
20+
```
21+
Add-VMAssignableDevice [-CimSession <CimSession[]>] [-ComputerName <String[]>]
22+
[-Credential <PSCredential[]>] [-VMName] <String[]> [-InstancePath <String>]
23+
[-LocationPath <String>] [-VirtualFunction <UInt16>] [-ResourcePoolName <String>] [-Passthru]
24+
[-WhatIf] [-Confirm] [<CommonParameters>]
25+
```
26+
27+
### VMObject
28+
29+
```
30+
Add-VMAssignableDevice [-VM] <VirtualMachine[]> [-InstancePath <String>] [-LocationPath <String>]
31+
[-VirtualFunction <UInt16>] [-ResourcePoolName <String>] [-Passthru] [-WhatIf] [-Confirm]
32+
[<CommonParameters>]
33+
```
34+
35+
## DESCRIPTION
36+
37+
The `Add-VMAssignableDevice` cmdlet assigns a physical device to a specified virtual machine (VM).
38+
This is commonly used for tasks such as attaching GPUs or network adapters directly to a VM to
39+
enhance performance for specific applications or workloads. The device can be specified through its
40+
instance path, location path, or assignable device object.
41+
42+
## EXAMPLES
43+
44+
### Example 1
45+
46+
```powershell
47+
Add-VMAssignableDevice -VMName "MyVM" -InstancePath "PCIROOT(0)#PCI(0300)#PCI(0000)"
48+
```
49+
50+
This example attaches a physical device, identified by its instance path, to the virtual machine
51+
named **MyVM**.
52+
53+
## PARAMETERS
54+
55+
### -CimSession
56+
57+
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session
58+
object, such as the output of a [New-CimSession](/powershell/module/cimcmdlets/new-cimsession)
59+
or [Get-CimSession](/powershell/module/cimcmdlets/get-cimsession) cmdlet. The default is the
60+
current session on the local computer.
61+
62+
```yaml
63+
Type: CimSession[]
64+
Parameter Sets: VMName
65+
Aliases:
66+
67+
Required: False
68+
Position: Named
69+
Default value: None
70+
Accept pipeline input: False
71+
Accept wildcard characters: False
72+
```
73+
74+
### -ComputerName
75+
76+
Specifies one or more Hyper-V hosts on which the assignable devices are to be retrieved. NetBIOS
77+
names, IP addresses, and fully qualified domain names are allowed. The default is the local
78+
computer. Use localhost or a dot (`.`) to specify the local computer explicitly.
79+
80+
```yaml
81+
Type: String[]
82+
Parameter Sets: VMName
83+
Aliases:
84+
85+
Required: False
86+
Position: Named
87+
Default value: None
88+
Accept pipeline input: False
89+
Accept wildcard characters: False
90+
```
91+
92+
### -Credential
93+
94+
Specifies one or more user accounts that have permission to perform this action. The default is the
95+
current user.
96+
97+
```yaml
98+
Type: PSCredential[]
99+
Parameter Sets: VMName
100+
Aliases:
101+
102+
Required: False
103+
Position: Named
104+
Default value: None
105+
Accept pipeline input: False
106+
Accept wildcard characters: False
107+
```
108+
109+
### -InstancePath
110+
111+
Represents the Device Instance path in the host machine.
112+
113+
```yaml
114+
Type: String
115+
Parameter Sets: (All)
116+
Aliases:
117+
118+
Required: False
119+
Position: Named
120+
Default value: None
121+
Accept pipeline input: False
122+
Accept wildcard characters: False
123+
```
124+
125+
### -LocationPath
126+
127+
Specifies the location path to the assignable device
128+
129+
```yaml
130+
Type: String
131+
Parameter Sets: (All)
132+
Aliases:
133+
134+
Required: False
135+
Position: Named
136+
Default value: None
137+
Accept pipeline input: False
138+
Accept wildcard characters: False
139+
```
140+
141+
### -Passthru
142+
143+
Returns an object for each process that the cmdlet started.
144+
145+
```yaml
146+
Type: SwitchParameter
147+
Parameter Sets: (All)
148+
Aliases:
149+
150+
Required: False
151+
Position: Named
152+
Default value: None
153+
Accept pipeline input: False
154+
Accept wildcard characters: False
155+
```
156+
157+
### -ResourcePoolName
158+
159+
Specifies the name of the resource pool to which the device is to be assigned.
160+
161+
```yaml
162+
Type: String
163+
Parameter Sets: (All)
164+
Aliases:
165+
166+
Required: False
167+
Position: Named
168+
Default value: None
169+
Accept pipeline input: False
170+
Accept wildcard characters: False
171+
```
172+
173+
### -VirtualFunction
174+
175+
Specifies the number of the virtual function (VF) of an SR-IOV-capable network adapter assigned to
176+
the virtual machine.
177+
178+
```yaml
179+
Type: UInt16
180+
Parameter Sets: (All)
181+
Aliases:
182+
183+
Required: False
184+
Position: Named
185+
Default value: None
186+
Accept pipeline input: False
187+
Accept wildcard characters: False
188+
```
189+
190+
### -VM
191+
192+
Specifies the virtual machine to which the device is to be assigned.
193+
194+
```yaml
195+
Type: VirtualMachine[]
196+
Parameter Sets: VMObject
197+
Aliases:
198+
199+
Required: True
200+
Position: 0
201+
Default value: None
202+
Accept pipeline input: True (ByValue)
203+
Accept wildcard characters: False
204+
```
205+
206+
### -VMName
207+
208+
Specifies the name of the virtual machine to which the device is to be assigned.
209+
210+
```yaml
211+
Type: String[]
212+
Parameter Sets: VMName
213+
Aliases:
214+
215+
Required: True
216+
Position: 0
217+
Default value: None
218+
Accept pipeline input: False
219+
Accept wildcard characters: False
220+
```
221+
222+
### -Confirm
223+
224+
Prompts you for confirmation before running the cmdlet.
225+
226+
```yaml
227+
Type: SwitchParameter
228+
Parameter Sets: (All)
229+
Aliases: cf
230+
231+
Required: False
232+
Position: Named
233+
Default value: None
234+
Accept pipeline input: False
235+
Accept wildcard characters: False
236+
```
237+
238+
### -WhatIf
239+
240+
Shows what would happen if the cmdlet runs. The cmdlet is not run.
241+
242+
```yaml
243+
Type: SwitchParameter
244+
Parameter Sets: (All)
245+
Aliases: wi
246+
247+
Required: False
248+
Position: Named
249+
Default value: None
250+
Accept pipeline input: False
251+
Accept wildcard characters: False
252+
```
253+
254+
### CommonParameters
255+
256+
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
257+
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
258+
-WarningAction, and -WarningVariable. For more information, see
259+
[about_CommonParameters](/powershell/module/microsoft.powershell.core/about/about_commonparameters).
260+
261+
## INPUTS
262+
263+
### Microsoft.HyperV.PowerShell.VirtualMachine[]
264+
265+
## OUTPUTS
266+
267+
### Microsoft.HyperV.PowerShell.VMAssignedDevice
268+
269+
## NOTES
270+
271+
## RELATED LINKS
272+
273+
[Get-VMAssignableDevice](get-vmassignabledevice.md)
274+
275+
[Remove-VMAssignableDevice](remove-vmassignabledevice.md)

0 commit comments

Comments
 (0)