Skip to content

Commit 0fbd521

Browse files
committed
More edits
1 parent 320f66f commit 0fbd521

File tree

3 files changed

+115
-49
lines changed

3 files changed

+115
-49
lines changed

docset/winserver2025-ps/VMDirectStorage/Add-VMDirectVirtualDisk.md

Lines changed: 46 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ai-usage: ai-generated
1212

1313
## Synopsis
1414

15-
Attaches a Storage Spaces Direct virtual disk to a virtual machine.
15+
Directly attaches a Storage Spaces Direct virtual disk to a virtual machine.
1616

1717
## Syntax
1818

@@ -41,13 +41,26 @@ Add-VMDirectVirtualDisk [-VMDriveController] <VMDriveController> [-ControllerLoc
4141

4242
## Description
4343

44-
The **Add-VMDirectVirtualDisk** cmdlet attaches a Storage Spaces Direct virtual disk to a virtual
45-
machine. This enables high-performance storage configurations by directly connecting the virtual
46-
disk to the VM.
44+
The **Add-VMDirectVirtualDisk** cmdlet directly attaches a Storage Spaces Direct virtual disk to a
45+
virtual machine. This enables high-performance storage configurations by directly connecting the
46+
virtual disk to the VM.
4747

4848
## Examples
4949

50-
### Example 1: Attach a virtual disk by specifying VM name and controller details
50+
### Example 1: Attach a virtual disk by using a virtual disk object
51+
52+
This example gets the Storage Spaces Direct virtual disk object named `Volume01` and the VM object
53+
named `VM1` on `Cluster01`, and then directly attaches the disk to the VM, using the first available
54+
controller and controller location.
55+
56+
```powershell
57+
$VirtualDisk = Get-VirtualDisk -FriendlyName "Volume01" -CimSession "Cluster01"
58+
$vm = Get-VM -Name "VM1" -CimSession "Cluster01"
59+
60+
Add-VMDirectVirtualDisk -VM $vm -VirtualDiskUniqueId $VirtualDisk.UniqueId
61+
```
62+
63+
### Example 2: Attach a virtual disk by specifying VM name and controller details
5164

5265
This example attaches the virtual disk with the unique ID `111BBE22FD037E4EB87F366648FBF111` to the
5366
virtual machine named `VM1` at controller 0, location 1.
@@ -64,25 +77,27 @@ $parameters = @{
6477
Add-VMDirectVirtualDisk @parameters
6578
```
6679

67-
### Example 2: Attach a virtual disk by using a virtual disk object
80+
### Example 3: Attach multiple virtual disks to a VM
6881

69-
This example gets the Storage Spaces Direct virtual disk object named `Volume01` and the VM object
70-
named `VM1`, and then directly attaches the disk to the VM.
82+
This example retrieves all virtual disks with names starting with `Volume0` from the cluster named
83+
`Cluster01` and attaches them to the virtual machine named `VM1`.
7184

7285
```powershell
73-
$virtualDisk = Get-VirtualDisk -Friendlyname "Volume01"
74-
$vm = Get-VM -Name "VM1"
86+
$VirtualDisks = Get-VirtualDisk -FriendlyName "Volume0*" -CimSession "Cluster01"
87+
$vm = Get-VM -Name "VM1" -CimSession "Cluster01"
7588
76-
Add-VMDirectVirtualDisk -VM $vm -VirtualDiskUniqueId $virtualDisk.UniqueId
89+
foreach ($diskID in $virtualdisks) {
90+
Add-VMDirectVirtualDisk -VM $vm -VirtualDiskUniqueId $diskID.UniqueID
91+
}
7792
```
7893

7994
## Parameters
8095

8196
### -CimSession
8297

83-
Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or
84-
a command that creates or gets the CIM session, such as `New-CimSession` or `Get-CimSession`. For more
85-
information, see
98+
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name, cluster name, or
99+
a session object, such as the output of a `New-CimSession` or `Get-CimSession` cmdlet. The default
100+
is the current session on the local computer. For more information, see
86101
[about_CimSession](/powershell/module/microsoft.powershell.core/about/about_cimsession).
87102

88103
```yaml
@@ -99,7 +114,8 @@ Accept wildcard characters: False
99114
100115
### -ControllerLocation
101116
102-
Specifies the location on the controller where the virtual disk will be attached.
117+
Specifies the location on the controller where the virtual disk will be attached. If you don't
118+
specify a controller location, the cmdlet uses the first available location.
103119
104120
```yaml
105121
Type: System.Int32
@@ -115,7 +131,8 @@ Accept wildcard characters: False
115131
116132
### -ControllerNumber
117133
118-
Specifies the number of the controller where the virtual disk will be attached.
134+
Specifies the number of the controller where the virtual disk will be attached. If you don't specify
135+
a controller number, the cmdlet uses the first available controller.
119136
120137
```yaml
121138
Type: System.Int32
@@ -131,7 +148,8 @@ Accept wildcard characters: False
131148
132149
### -ControllerType
133150
134-
Specifies the type of controller. Only SCSI is supported.
151+
Specifies the type of controller used by the VM. If you don't specify a controller type, the cmdlet
152+
uses the SCSI controller type, which is the only type supported at this time.
135153
136154
```yaml
137155
Type: ControllerType
@@ -148,7 +166,8 @@ Accept wildcard characters: False
148166
149167
### -VirtualDiskUniqueId
150168
151-
Specifies the unique ID of the virtual disk to attach.
169+
Specifies the unique ID of the Storage Spaces virtual disk to attach. For example,
170+
`111BBE22-FD03-7E4E-B87F-366648FBF111`.
152171

153172
```yaml
154173
Type: System.String
@@ -164,7 +183,7 @@ Accept wildcard characters: False
164183

165184
### -VM
166185

167-
Specifies the virtual machine object to which the virtual disk will be attached.
186+
Specifies a virtual machine object to which the virtual disk will be attached.
168187

169188
```yaml
170189
Type: Microsoft.HyperV.PowerShell.VirtualMachine[]
@@ -221,21 +240,24 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
221240

222241
### System.String[]
223242

224-
Specifies the names of virtual machines.
243+
Specifies the name of a virtual machine.
225244

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

228-
Specifies virtual machine objects.
247+
Specifies a virtual machine object to which the virtual disk will be attached. You can use the
248+
[Get-VM](/powershell/module/hyper-v/get-vm) cmdlet to get the virtual machine object.
229249

230250
### Microsoft.HyperV.PowerShell.VMDriveController
231251

232-
Specifies drive controller objects.
252+
Specifies a drive controller object to which the virtual disk will be attached. You can use
253+
the [Get-VmScsiController](/powershell/module/hyper-v/get-vmscsicontroller) cmdlet to get the drive
254+
controller object.
233255

234256
## Outputs
235257

236-
### System.Object
258+
### None
237259

238-
Returns an object representing the result of the operation.
260+
This cmdlet returns no output of its own.
239261

240262
## Notes
241263

docset/winserver2025-ps/VMDirectStorage/Get-VMDirectVirtualDisk.md

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ name, and its location on the controller.
4545

4646
## Examples
4747

48-
### Example 1: Retrieve virtual disks by virtual machine name
48+
### Example 1: Retrieve directly attached virtual disks by VM name
4949

50-
This command retrieves all virtual disks attached to the virtual machine named "VM1".
50+
This command retrieves all virtual disks attached to the virtual machine named `VM1` running on the
51+
cluster named `Cluster01`.
5152

5253
```powershell
53-
Get-VMDirectVirtualDisk -VMName "VM1"
54+
Get-VMDirectVirtualDisk -VMName "VM1" -CimSession "Cluster01"
5455
```
5556

5657
```Output
@@ -59,23 +60,42 @@ VMName ControllerType ControllerNumber ControllerLocation VirtualDiskFriendlyNam
5960
VM1 SCSI 0 1 Volume01 111BBE22FD037E4E...
6061
```
6162

62-
### Example 2: Retrieve virtual disks by virtual machine object
63+
### Example 2: Retrieve directly attached virtual disks by VM object
6364

64-
This command gets the virtual machine object for "VM1" and then retrieves its directly attached
65-
virtual disks.
65+
This command gets the virtual machine object for `VM1` running on `Cluster01` and then retrieves its
66+
directly attached virtual disks.
6667

6768
```powershell
68-
$vm = Get-VM -Name "VM1"
69+
$vm = Get-VM -Name "VM1" -CimSession "Cluster01"
6970
Get-VMDirectVirtualDisk -VM $vm
7071
```
7172

73+
### Example 3: Retrieve virtual disks by drive controller object
74+
75+
This command gets the drive controller object for the virtual machine named `VM1` running on
76+
`Cluster01` and retrieves the directly attached virtual disks.
77+
78+
```powershell
79+
$vm = Get-VM -Name "VM1" -CimSession "Cluster01"
80+
$controller = Get-VMScsiController -VMName "VM1" -CimSession "Cluster01"
81+
82+
Get-VMDirectVirtualDisk -VMDriveController $controller
83+
```
84+
85+
```Output
86+
VMName ControllerType ControllerNumber ControllerLocation VirtualDiskFriendlyName VirtualDiskUniqueId
87+
------ -------------- ---------------- ------------------ ----------------------- -------------------
88+
VM1 SCSI 0 1 Volume01 111BBE22FD037E4E...
89+
VM1 SCSI 0 2 Volume02 222BBE22FD037E4E...
90+
```
91+
7292
## Parameters
7393

7494
### -CimSession
7595

76-
Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or
77-
a command that creates or gets the CIM session, such as `New-CimSession` or `Get-CimSession`. For more
78-
information, see
96+
Runs the cmdlet in a remote session or on a remote computer. Enter a computer name, cluster name, or
97+
a session object, such as the output of a `New-CimSession` or `Get-CimSession` cmdlet. The default
98+
is the current session on the local computer. For more information, see
7999
[about_CimSession](/powershell/module/microsoft.powershell.core/about/about_cimsession).
80100

81101
```yaml
@@ -92,7 +112,8 @@ Accept wildcard characters: False
92112
93113
### -ControllerLocation
94114
95-
Specifies the location of the virtual disk on the controller.
115+
Specifies the location of the virtual disk on the controller. If you don't specify a controller
116+
location, the cmdlet returns all virtual disks attached to the specified controller.
96117
97118
```yaml
98119
Type: System.Int32
@@ -108,7 +129,8 @@ Accept wildcard characters: False
108129
109130
### -ControllerNumber
110131
111-
Specifies the number of the controller where the virtual disk is attached.
132+
Specifies the number of the controller where the virtual disk is attached. If you don't specify a
133+
controller number, the cmdlet returns all virtual disks attached to the specified controller.
112134
113135
```yaml
114136
Type: System.Int32
@@ -124,7 +146,8 @@ Accept wildcard characters: False
124146
125147
### -ControllerType
126148
127-
Specifies the type of controller. Only SCSI is supported.
149+
Specifies the type of controller used by the VM. If you don't specify a controller type, the cmdlet
150+
uses the SCSI controller type, which is the only type supported at this time.
128151
129152
```yaml
130153
Type: ControllerType
@@ -157,7 +180,8 @@ Accept wildcard characters: False
157180
158181
### -VMDriveController
159182
160-
Specifies the drive controller object for which to retrieve virtual disk information.
183+
Specifies the drive controller object for which to retrieve virtual disk information. You can use
184+
the [Get-VmScsiController](/powershell/module/hyper-v/get-vmscsicontroller) cmdlet to get the drive controller object.
161185
162186
```yaml
163187
Type: Microsoft.HyperV.PowerShell.VMDriveController[]
@@ -198,15 +222,35 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
198222
199223
### System.String[]
200224
201-
Specifies the names of virtual machines.
225+
Specifies the name of a virtual machine.
226+
227+
### Microsoft.HyperV.PowerShell.VirtualMachine[]
228+
229+
Specifies the virtual machine object for which to get directly attached virtual disks. You can use
230+
the [Get-VM](/powershell/module/hyper-v/get-vm) cmdlet to get the virtual machine object.
231+
232+
### Microsoft.HyperV.PowerShell.VMDriveController[]
233+
234+
Specifies the drive controller objects for which to get directly attached virtual disks. You can use
235+
the [Get-VmScsiController](/powershell/module/hyper-v/get-vmscsicontroller) cmdlet to get the drive
236+
controller object.
237+
238+
## Inputs
239+
240+
### System.String[]
241+
242+
Specifies the name of a virtual machine.
202243
203244
### Microsoft.HyperV.PowerShell.VirtualMachine[]
204245
205-
Specifies virtual machine objects.
246+
Specifies the virtual machine object for which to get directly attached virtual disks. You can use
247+
the [Get-VM](/powershell/module/hyper-v/get-vm) cmdlet to get the virtual machine object.
206248
207249
### Microsoft.HyperV.PowerShell.VMDriveController[]
208250
209-
Specifies drive controller objects.
251+
Specifies the drive controller objects for which to get directly attached virtual disks. You can use
252+
the [Get-VmScsiController](/powershell/module/hyper-v/get-vmscsicontroller) cmdlet to get the drive
253+
controller object.
210254
211255
## Outputs
212256

docset/winserver2025-ps/VMDirectStorage/Remove-VMDirectVirtualDisk.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ virtual machine. This operation ensures that the virtual disk is no longer acces
3939
### Example 1: Detach a virtual disk by specifying VM name and controller details
4040

4141
This command detaches the virtual disk located at controller 0, location 1, from the virtual machine
42-
named "VM1".
42+
named `VM1`.
4343

4444
```powershell
4545
$parameters = @{
@@ -53,20 +53,20 @@ Remove-VMDirectVirtualDisk @parameters
5353

5454
### Example 2: Detach a virtual disk by using the virtual disk object
5555

56-
This example gets the virtual disk object attached to "VM1" and then removes it.
56+
This example gets the virtual disk object attached to `VM1` on `Cluster01` and then removes it.
5757

5858
```powershell
59-
$virtualDisk = Get-VMDirectVirtualDisk -VMName "VM1"
60-
Remove-VMDirectVirtualDisk -VirtualDisk $virtualDisk
59+
$VmDirectDisk = Get-VMDirectVirtualDisk -VMName "VM1" -CimSession "Cluster01"
60+
Remove-VMDirectVirtualDisk -VirtualDisk $VmDirectDisk
6161
```
6262

6363
## Parameters
6464

6565
### -CimSession
6666

6767
Runs the command using the specified CIM session. Enter a variable that contains the CIM session, or
68-
a command that creates or gets the CIM session, such as `New-CimSession` or `Get-CimSession`. For more
69-
information, see
68+
a command that creates or gets the CIM session, such as `New-CimSession` or `Get-CimSession`. For
69+
more information, see
7070
[about_CimSession](/powershell/module/microsoft.powershell.core/about/about_cimsession).
7171

7272
```yaml
@@ -181,9 +181,9 @@ Specifies the virtual disk objects to be detached.
181181
182182
## Outputs
183183
184-
### System.Object
184+
### None
185185
186-
Returns an object representing the result of the operation.
186+
This cmdlet returns no output of its own.
187187
188188
## Notes
189189

0 commit comments

Comments
 (0)