Set-SCVirtualHardDisk

Changes the properties of a virtual hard disk object used in VMM.

Syntax

Set-SCVirtualHardDisk
   [-OperatingSystem <OperatingSystem>]
   [-VirtualizationPlatform <VirtualizationPlatform>]
   [-Tag <System.Collections.Generic.List`1[System.String]>]
   [-ProductKey <String>]
   [-UserRole <UserRole>]
   [-Enabled <Boolean>]
   [-VMMServer <ServerConnection>]
   [-VirtualHardDisk] <VirtualHardDisk>
   [-JobGroup <Guid>]
   [-Name <String>]
   [-SharePath <String>]
   [-Description <String>]
   [-Owner <String>]
   [-FamilyName <String>]
   [-Release <String>]
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]
Set-SCVirtualHardDisk
   [-VMMServer <ServerConnection>]
   [-VirtualHardDisks] <System.Collections.Generic.List`1[Microsoft.SystemCenter.VirtualMachineManager.VirtualHardDisk]>
   -FamilyName <String>
   -Release <String>
   [-RunAsynchronously]
   [-PROTipID <Guid>]
   [-JobVariable <String>]
   [<CommonParameters>]

Description

The Set-SCVirtualHardDisk cmdlet changes one or more properties of a virtual hard disk object used in a Virtual Machine Manager (VMM) environment. A virtual hard disk file used in VMM is either a Windows-based .vhd file, a Citrix XenServer-based .vhd file, or a VMware-based .vmdk file.

Properties that you can change include:

  • Description
  • Enabled
  • Name
  • Operating System
  • Owner
  • SharePath

A virtual hard disk file might be stored in the VMM library, or it might be attached to a virtual disk drive on a virtual machine or template.

To change the Bus and LUN settings for a virtual disk drive, use the Set-SCVirtualDiskDrive cmdlet.

Examples

Example 1: Change the description of a virtual hard disk

PS C:\> $VHD = Get-SCVirtualHardDisk -VMMServer "VMMServer01.Contoso.com" | where { $_.LibraryServer.Name -eq "LibraryServer01.Contoso.com" -and $_.Name -eq "WindowsServer2008R2BootVHD.vhd"}
PS C:\> Set-SCVirtualHardDisk -VirtualHardDisk $VHD -Description "Latest Windows Server 2008 R2 Boot VHD"

The first command retrieves the virtual hard disk object named "WindowsServer2003BootVHD.vhd" from the library on VMMServer01 and then stores the object in the $VHD variable.

The second command changes the description of the virtual hard disk object stored in $VHD to "Latest Windows Server 2008 R2 Boot VHD".

Example 2: Enable a VMware-based virtual hard disk in the library

PS C:\> $VMDK = Get-SCVirtualHardDisk -VMMServer "VMMServer01.Contoso.com" | where { $_.LibraryServer.Name -eq "LibraryServer01.Contoso.com" -and $_.Name -eq "WindowsServer2008.vmdk"}
PS C:\> Set-SCVirtualHardDisk -VirtualHardDisk $VMDK -Enabled $FALSE

The first command gets the virtual hard disk object named WindowsServer2008.vmdk and then stores the virtual hard disk object in the $VMDK variable.

The second command disables the virtual hard disk object stored in $VMDK.

Example 3: Specify an owner for all virtual hard disks with an "Unknown" owner

PS C:\> Get-SCVirtualHardDisk -VMMServer "VMMServer01.Contoso.com" | where {$_.Owner -eq "Unknown"} | Set-SCVirtualHardDisk -Owner "Contoso\ReneeLo"

This command gets all virtual hard disk objects from the VMM library whose owner is "Unknown", and then specifies an owner for each virtual hard disk object.

Parameters

-Description

Specifies a description for the virtual hard disk object.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

Enables an object when set to $True, or disables an object when set to $False. For example, if you want to upgrade software on a virtual machine template, you can disable the template object in the VMM library to temporarily prevent users from using that object.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FamilyName

Specifies a family name for a physical resource in the VMM library. This value is used in conjunction with Release, Namespace, and Type to establish equivalency among library resources.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-JobGroup

Specifies an identifier for a series of commands that will run as a set just before the final command that includes the same job group identifier runs.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-JobVariable

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of a VMM object.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-OperatingSystem

Specifies the type of operating system for a virtual machine. To list the names of all available operating systems in VMM, type Get-SCOperatingSystem.

Type:OperatingSystem
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Owner

Specifies the owner of a VMM object in the form of a valid domain user account.

  • Example format: -Owner "Contoso\PattiFuller"
  • Example format: -Owner "PattiFuller@Contoso"
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ProductKey

Specifies a product key. The product key is a 25-digit number that identifies the product license. A product key can be used to register VMM or an operating system to be installed on a virtual machine or host.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Type:Guid
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Release

Specifies a string that describes the release of a library resource. VMM automatically creates a release value for every resource imported into the library. After the resource has been imported, the string can be customized.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RunAsynchronously

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SharePath

Specifies a path to a valid library share on an existing library server that uses a Universal Naming Convention (UNC) path.

Example format: -SharePath "\\LibServer01\LibShare"

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Tag

Specifies a word or phrase to associate with an object so that you can search for all objects with the specified set of tags. You can search for a subset of tags, or you can search for the full set of tags.

Type:System.Collections.Generic.List`1[System.String]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserRole

Specifies a user role object.

Type:UserRole
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VirtualHardDisk

Specifies a virtual hard disk object.

Type:VirtualHardDisk
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VirtualHardDisks

Specifies an array of virtual hard disk objects.

Type:System.Collections.Generic.List`1[Microsoft.SystemCenter.VirtualMachineManager.VirtualHardDisk]
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VirtualizationPlatform

Specifies the virtualization platform of a virtual machine host managed by VMM. The acceptable values for this parameter are:

  • HyperV
  • VMwareESX
  • XENServer
Type:VirtualizationPlatform
Accepted values:Unknown, VirtualServer, HyperV, VMWareVC, VMWareESX, XENServer
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-VMMServer

Specifies a VMM server object.

Type:ServerConnection
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Outputs

VirtualHardDisk

This cmdlet returns a VirtualHardDisk object.

Notes

  • Requires a VMM virtual hard disk object, which can be retrieved by using the Get-SCVirtualHardDisk cmdlet.