Set-SCVirtualHardDiskConfiguration

Set-SCVirtualHardDiskConfiguration

Modifies the virtual hard disk configuration information contained within a virtual machine configuration.

Syntax

Parameter Set: Default
Set-SCVirtualHardDiskConfiguration -VHDConfiguration <VirtualHardDiskConfiguration> [-DeploymentOption <DeploymentOption> {None | UseFastest | UseTarget | UseNetwork | UseSAN | UseDifferencing | UseExistingVirtualDisk} ] [-DestinationLocation <String> ] [-FileInjectionDestinationLocation <String> ] [-FileInjectionDestinationPartition <Int16> ] [-FileInjectionSourceLocation <String> ] [-FileName <String> ] [-JobVariable <String> ] [-ParentVirtualHardDiskDestinationPath <String> ] [-ParentVirtualHardDiskPath <String> ] [-PinDestinationLocation <Boolean> ] [-PinFileName <Boolean> ] [-PinSourceLocation <Boolean> ] [-PinStorageDisk <Boolean> ] [-PROTipID <Guid]> ] [-RunAsynchronously] [-SourceDisk <StandaloneVirtualHardDisk> ] [-StorageClassification <StorageClassification> ] [-StorageDisk <StorageDisk> ] [ <CommonParameters>]

Detailed Description

The Set-SCVirtualHardDiskConfiguration cmdlet modifies the virtual hard disk configuration information that is contained within a virtual machine configuration.

Parameters

-DeploymentOption<DeploymentOption>

Specifies the deployment option for a virtual hard disk. Valid values are:

-- None
-- UseFastest
-- UseTarget
-- UseNetwork
-- UseSAN
-- UseDifferencing
-- UseExistingVirtualDisk

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DestinationLocation<String>

Specifies the destination path for or on a virtual hard disk.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FileInjectionDestinationLocation<String>

Specifies the target folder path (relative path to the root of the partition) where the source file(s) will be injected into the selected VHD prior to turning on the virtual machine for the first time.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FileInjectionDestinationPartition<Int16>

Specifies the target partition of the selected VHD where the source files will be injected prior to turning on the virtual machine for the first time.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FileInjectionSourceLocation<String>

Specifies the location (an URL) of the file(s) to be injected into the virtual machine prior to turning on the virtual machine for the first time.

When a folder is provided, all files under that folder will be injected into the specified destination location.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FileName<String>

Specifies the file name to use when you rename a virtual hard disk file as you add it to a virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobVariable<String>

Specifies that job progress is tracked and stored in the variable named by this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ParentVirtualHardDiskDestinationPath<String>

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ParentVirtualHardDiskPath<String>

Specifies the path to the parent virtual hard disk to be used when creating a differencing disk.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PinDestinationLocation<Boolean>

Indicates whether the destination location chosen by the user is retained during service deployment configuration.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PinFileName<Boolean>

Indicates whether the file name chosen by the user is retained during service deployment configuration.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PinSourceLocation<Boolean>

Indicates whether the source location chosen by the user is retained during service deployment configuration.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PinStorageDisk<Boolean>

Indicates whether the storage disk chosen by the user is retained during service deployment configuration.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-PROTipID<Guid]>

Specifies the ID of the PRO tip that triggered this action. This allows for auditing of PRO tips.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-SourceDisk<StandaloneVirtualHardDisk>

Specifies the source virtual hard disk.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StorageClassification<StorageClassification>

Specifies a storage classification object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StorageDisk<StorageDisk>

Specifies a disk on a Hyper-V or VMware ESX host that a virtual machine on that host can use instead of using a virtual hard disk. This disk is referred to as a pass-through disk (the corresponding VMware term is Raw Device Mapping, or RDM). The host disk is either a local hard disk or a logical unit on a Storage Area Network (SAN). VMM lets the virtual machine bypass the host's file system and access the pass-through disk directly. The types of host and whether each has pass-through disk support are:

Hyper-V: Supports pass-through disks and supports converting a pass-through disk to a VHD.

VMware ESX: Supports pass-through disks (RDP), but not disk conversion.

Citrix XenServer: Does not support pass-through disks.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VHDConfiguration<VirtualHardDiskConfiguration>

Specifies a virtual hard disk configuration object.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByValue)

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.

  • VirtualHardDiskConfiguration

Examples

Example 1: Set the properties of a virtual hard disk configuration

The first command gets the service configuration object named Service01, and then stores the object in the $ServiceConfig variable.

The second command gets the computer tier configuration for the service configuration object stored in $ServiceConfig, and then stores the object in the $TierConfig variable.

The third command gets the virtual machine configuration for the computer tier configuration stored in $TierConfig, and then stores the object in the $VMConfig variable.

The fourth command gets the virtual hard disk configuration for the first virtual machine configuration stored in $VMConfig, and then stores the object in the $VHDConfig variable.

The fifth command gets the virtual hard disk object named Win2k8R2BaseDisk.vhd from the library, and then stores the object in the $VHD variable.

The last command updates the PinSourceLocation property in the virtual hard disk configuration stored in $VHDConfig for the source virtual hard disk stored in $VHD to pin the value of the source virtual hard disk, thereby preventing it from being changed during placement.

PS C:\> $ServiceConfig = Get-SCServiceConfiguration -Name "Service01"
PS C:\> $TierConfig = Get-SCComputerTierConfiguration -ServiceConfiguration $ServiceConfig
PS C:\> $VMConfig = Get-SCVMConfiguration -ComputerTierConfiguration $TierConfig
PS C:\> $VHDConfig = Get-SCVirtualHardDiskConfiguration -VMConfiguration $VMConfig[0]
PS C:\> $VHD = Get-SCVirtualHardDisk -Name "Win2k8R2BaseDisk.vhd"
PS C:\> Set-SCVirtualHardDiskConfiguration -VHDConfiguration $VHDConfig -SourceDisk $VHD -PinSourceLocation $True

Get-SCComputerTierConfiguration

Get-SCServiceConfiguration

Get-SCVirtualHardDisk

Get-SCVirtualHardDiskConfiguration

Get-SCVMConfiguration