Set-VMHardDiskDrive
Set-VMHardDiskDrive
Configures a virtual hard disk.
Syntax
Parameter Set: VMName
Set-VMHardDiskDrive [-VMName] <String> [[-ControllerType] <ControllerType> ] [[-ControllerNumber] <Int32> ] [[-ControllerLocation] <Int32> ] [[-Path] <String> ] [-AllowUnverifiedPaths] [-ComputerName <String[]> ] [-DiskNumber <UInt32> ] [-Passthru] [-ResourcePoolName <String> ] [-ToControllerLocation <Int32> ] [-ToControllerNumber <Int32> ] [-ToControllerType <ControllerType> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: Object
Set-VMHardDiskDrive [-VMHardDiskDrive] <HardDiskDrive[]> [[-Path] <String> ] [-AllowUnverifiedPaths] [-ComputerName <String[]> ] [-DiskNumber <UInt32> ] [-Passthru] [-ResourcePoolName <String> ] [-ToControllerLocation <Int32> ] [-ToControllerNumber <Int32> ] [-ToControllerType <ControllerType> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Set-VMHardDiskDrive cmdlet configures a virtual hard disk.
Parameters
-ComputerName<String[]>
Specifies one or more Hyper-V hosts on which the virtual hard drive is to be configured. NetBIOS names, IP addresses, and fully-qualified domain names are allowable. The default is the local computer — use “localhost” or a dot (“.”) to specify the local computer explicitly.
Aliases |
PSComputerName |
Required? |
false |
Position? |
named |
Default Value |
. |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-ControllerLocation<Int32>
Specifies the number of the location on the controller to which the virtual hard drive to be configured is attached. If not specified, all hard drives are configured.
Aliases |
none |
Required? |
false |
Position? |
4 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ControllerNumber<Int32>
Specifies the number of the controller to which the virtual hard drive to be configured is attached. If not specified, all hard drives are configured.
Aliases |
none |
Required? |
false |
Position? |
3 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ControllerType<ControllerType>
Specifies the type of the controller to which the virtual hard drive to be configured is attached. Allowed values are IDE and SCSI.
Aliases |
none |
Required? |
false |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Passthru
Specifies that a Microsoft.Virtualization.Powershell.HardDiskDrive object is to be passed through to the pipeline representing the virtual hard drive to be configured.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Path<String>
Specifies the path to media the virtual hard disk is to use.
Aliases |
none |
Required? |
false |
Position? |
5 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ResourcePoolName<String>
Specifies the name of the virtual hard disk resource pool to which this drive belongs.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMHardDiskDrive<HardDiskDrive[]>
Specifies one or more hard disks to be configured.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-AllowUnverifiedPaths
Specifies that no error is to be thrown if the specified path is not verified as accessible by the cluster. This parameter is applicable to clustered virtual machines.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DiskNumber<UInt32>
Specifies the disk number of the offline physical hard drive that should be connected as a passthrough disk.
Aliases |
Number |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-ToControllerLocation<Int32>
Specifies the controller location to which this drive should be moved. Allowed values are 0 and 1 for IDE controllers, and from 0 to 63 for SCSI controllers.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ToControllerNumber<Int32>
Specifies the controller location to which this drive should be moved. Allowed values are 0 and 1 for IDE controllers, and from 0 to 3 for SCSI controllers.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ToControllerType<ControllerType>
Specifies the type of controller to which this drive should be moved. Allowed values are IDE and SCSI.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VMName<String>
Specifies the name of the virtual machine on which the virtual hard drive is to be configured.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1
Configures the hard drive of virtual machine TestVM to use Test.vhd as its media.
PS C:\> Set-VMHardDiskDrive -VMName TestVM -Path .\Test.vhd
Example 2
Moves the virtual hard drive on virtual machine TestVM from IDE 1,0 to IDE 1,1.
PS C:\> Get-VMHardDiskDrive -VMName TestVM –ControllerType IDE -ControllerNumber 1 -ControllerLocation 0 | Set-VMHardDiskDrive -ToControllerLocation 1