Set-SCVirtualMachine

Applies To: System Center 2012 - Virtual Machine Manager

Set-SCVirtualMachine

Changes properties of a virtual machine managed by VMM.

Syntax

Parameter Set: SingleVM
Set-SCVirtualMachine [-VM] <VM> [-BlockDynamicOptimization <Boolean> ] [-BootOrder <BootDevice[]> ] [-CapabilityProfile <CapabilityProfile> ] [-Cloud <Cloud> ] [-CostCenter <String> ] [-CPUCount <Byte> ] [-CPUExpectedUtilizationPercent <Int32> ] [-CPULimitForMigration <Boolean> ] [-CPULimitFunctionality <Boolean> ] [-CPUMaximumPercent <Int32> ] [-CPURelativeWeight <Int32> ] [-CPUReserve <Int32> ] [-CPUType <ProcessorType> ] [-Custom1 <String> ] [-Custom10 <String> ] [-Custom2 <String> ] [-Custom3 <String> ] [-Custom4 <String> ] [-Custom5 <String> ] [-Custom6 <String> ] [-Custom7 <String> ] [-Custom8 <String> ] [-Custom9 <String> ] [-DelayStartSeconds <Int32> ] [-Description <String> ] [-DiskIops <Int32> ] [-DynamicMemoryBufferPercentage <Int32> ] [-DynamicMemoryEnabled <Boolean> ] [-DynamicMemoryMaximumMB <Int32> ] [-EnableBackup <Boolean> ] [-Enabled <Boolean> ] [-EnableDataExchange <Boolean> ] [-EnableHeartbeat <Boolean> ] [-EnableOperatingSystemShutdown <Boolean> ] [-EnableTimeSync <Boolean> ] [-HighlyAvailable <Boolean> ] [-InstallVirtualizationGuestServices <Boolean> ] [-JobGroup <Guid> ] [-JobVariable <String> ] [-MemoryMB <Int32> ] [-MemoryWeight <Int32> ] [-MonitorMaximumCount <Int32> ] [-MonitorMaximumResolution <String> ] [-Name <String> ] [-NetworkUtilizationMbps <Int32> ] [-NumLock <Boolean> ] [-OperatingSystem <OperatingSystem> ] [-Owner <String> ] [-PROTipID <Guid> ] [-QuotaPoint <UInt32> ] [-RemoveCapabilityProfile] [-RemoveFromCloud] [-RemoveSelfServiceUserRole <Boolean> ] [-RunAsSystem] [-RunAsUserCredential <PSCredential> ] [-RunAsynchronously] [-StartAction <VMStartAction> ] [-StopAction <VMStopAction> ] [-Tag <String> ] [-UseHardwareAssistedVirtualization <Boolean> ] [-UserRole <UserRole> ] [-VirtualVideoAdapterEnabled <Boolean> ] [-VMwareResourcePool <VmwResourcePool> ] [ <CommonParameters>]

Detailed Description

The Set-SCVirtualMachine cmdlet changes one or more properties of a virtual machine managed by System Center Virtual Machine Manager (VMM). Properties that you can change include the following:

- Name, owner, and description of a virtual machine.

- BIOS boot order (if deployed on a Hyper-V host).

- Amount of resources on the host used by a virtual machine. These include:

- Maximum amount of host CPU resources that a virtual machine can use.

- Expected use of host CPU by a virtual machine.

- Amount of host CPU resources used by one virtual machine relative to

other virtual machines on the same host.

- Amount of host memory that a virtual machine can use.

- Amount of bandwidth on the host's network that a virtual machine can use.

- Hardware settings for a virtual machine unrelated to host resources. These include:

- Number of CPUs.

- Type of CPU.

- Number of disk input/output operations per second (IOPS).

- Limiting CPU functionality (for an older operating system,

such as Windows NT 4.0).

- Cost center, tag, and custom settings used to filter virtual machines by criteria.

- Settings that enable various optional capabilities, including:

- Enabling or disabling a library object to make it available,

or temporarily unavailable, to users.

- Enabling backing up a virtual machine on a Hyper-V host with Volume Shadow Copy

service.

- Enabling a key/value pair for data exchange between a virtual machine and its

Hyper-V host.

- Enabling shutdown of a virtual machine from the Hyper-V console.

- Enabling time synchronization between a virtual machine and its Hyper-V host.

- Enabling the BIOS value for NumLock for a virtual machine on a Hyper-V host.

- Setting that identifies whether a virtual machine is highly available, that is,

a virtual machine to be deployed on a node of a Hyper-V host cluster or a Citrix

XenServer host cluster.

- Setting that determines whether virtualization guest services are

installed on a virtual machine deployed on a Hyper-V host.

- Number of seconds to delay before starting a virtual machine.

- Setting that identifies the operating system used for a virtual machine.

- Start and stop actions for a virtual machine.

- Setting that limits the number of virtual machines self-service users can create.

- Setting used to switch the role that a self-service user who belongs

to multiple roles uses to manage a virtual machine.

- Setting that assigns a virtual machine on an ESX host to a VMware resource pool.

If you want to change the properties of a virtual floppy drive, virtual DVD drive, virtual network adapter, or virtual SCSI adapter associated with a specific virtual machine, use the Set-SCVirtualFloppyDrive, Set-SCVirtualDVDDrive, Set-SCVirtualNetworkAdapter, or Set-SCVirtualScsiAdapter cmdlets, respectively.

For more information about Set-SCVirtualMachine, type: "Get-Help Set-SCVirtualMachine -online".

Parameters

-BlockDynamicOptimization<Boolean>

Indicates whether dynamic optimization is blocked for a virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-BootOrder<BootDevice[]>

Specifies the order of devices that a virtual machine on a Hyper-V host uses to start up. Valid values are: CD, IDEHardDrive, PXEBoot, Floppy.

Example format: -BootOrder PXEBoot,IDEHardDrive,CD,Floppy

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CapabilityProfile<CapabilityProfile>

Specifies a capability profile object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Cloud<Cloud>

Specifies a private cloud object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CostCenter<String>

Specifies the cost center for a virtual machine so that you can collect data about the allocation of virtual machines (or resources allocated to virtual machines) to make use of in your billing system.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPUCount<Byte>

Specifies the number of CPUs on a virtual machine, on a hardware profile, or on a template. See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

TYPE OF HOST NUMBER OF PROCESSORS

------------ --------------------

Hyper-V Up to 4 CPUs per VM; varies by guest OS

VMware ESX Up to 4 CPUs per VM for any supported guest OS

Exception: 1 CPU on a VM running Windows NT 4.0

Citrix XenServer Up to 8 CPUs per VM; varies by guest OS

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPUExpectedUtilizationPercent<Int32>

Specifies the percent of CPU on the host that you expect this virtual machine to use. This value is used only when VMM determines a suitable host for the virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPULimitForMigration<Boolean>

Limits, when set to $True, processor features for the specified virtual machine in order to enable migration to a physical computer that has a different version of the same processor as the source computer. VMM does not support migrating virtual machines between physical computers that have processors from different manufacturers.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CPULimitFunctionality<Boolean>

Enables running an older operating system (such as Windows NT 4.0) on a virtual machine deployed on a Hyper-V host or on a VMware ESX host by providing limited CPU functionality for the virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CPUMaximumPercent<Int32>

Specifies the highest percentage of the total resources of a single CPU on the host that can be used by a specific virtual machine at any given time.

Example: -CPUMaximumPercent 80 (to specify 80 per cent)

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPURelativeWeight<Int32>

Specifies the amount of CPU resources on a host that this virtual machine can use relative to other virtual machines on the same host. A virtual machine with a higher setting is allocated more CPU resources than a virtual machine with a lower setting.

TYPE OF HOST RANGE OF RELATIVE VALUES

------------ ------------------------

Hyper-V 1 to 10000

VMware ESX 2000 = High

1500 = Above Normal

1000 = Normal (default)

750 = Below Normal

500 = Low

1 to 1000000 = Custom

The VMware term for these values is "shares."

Citrix XenServer 1 to 65536, normal is 256

NOTE: See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPUReserve<Int32>

Specifies the minimum percentage of the resources of a single CPU on the host to allocate to a virtual machine. The percentage of CPU capacity that is available to the virtual machine is never less than this percentage.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-CPUType<ProcessorType>

Specifies the type of CPU for a virtual machine. To retrieve a list of all CPU types that are available for use in virtual machines in a VMM environment, type: "Get-SCCPUType"

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom1<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom10<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom2<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom3<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom4<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom5<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom6<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom7<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom8<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Custom9<String>

Specifies a custom property on a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-DelayStartSeconds<Int32>

Specifies the number of seconds to wait after the virtualization service starts before automatically starting a virtual machine. This delay is used to stagger the startup time of multiple virtual machines to help reduce the demand on the physical computer"s resources. A typical setting might be 30 to 60 seconds.

TYPE OF HOST MAXIMUM CONFIGURABLE DELAY

------------ --------------------------------

Hyper-V 1000000000 seconds (277777 hours)

VMware ESX 65535 seconds (18 hours)

Citrix XenServer Does not apply to XenServer virtual machines

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Description<String>

States a description for the specified object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-DiskIops<Int32>

Specifies the number of disk input/output operations per second (IOPS) on the host that can be used by a specific virtual machine.

Example: -DiskIO 1500 (to specify 1500 IOPS).

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-DynamicMemoryBufferPercentage<Int32>

Specifies the percentage of memory above a virtual machine"s current memory allocation which the host should try to reserve as a buffer. The default value is 20

Example format: -DynamicMemoryTargetBufferPercentage 20

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DynamicMemoryEnabled<Boolean>

Enables, when set to $True, dynamic memory for virtual machines. You can enable dynamic memory directly on a virtual machine, or on a template or hardware profile that will be used to create virtual machines. The default value is False.

REQUIRED: You can enable dynamic memory for a virtual machine only if that virtual machine is deployed on a host running Windows Server 2008 SP1 or later or if the virtual machine is stored in a library in a stopped state (hardware changes to a stored virtual machine can only be made if the virtual machine does not have snapshots). Enabling dynamic memory on a virtual machine stored in a library will limit placement of that machine to hosts running Windows Server 2008 SP1 or later.

Example format: -DynamicMemoryEnabled $True

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-DynamicMemoryMaximumMB<Int32>

Specifies the maximum amount of memory that can be allocated to a virtual machine if dynamic memory is enabled. The default value is 65536.

REQUIRED: You can enable dynamic memory for a virtual machine only if that virtual machine is deployed on a host running Windows Server 2008 R2 SP1 or later or if the virtual machine is stored in a library in a stopped state (hardware changes to a stored virtual machine can only be made if the virtual machine does not have snapshots). Enabling dynamic memory on a virtual machine stored in a library will limit placement of that machine to hosts running Windows Server 2008 R2 SP1 or later.

Example format: -DynamicMemoryMaximumMB 1024

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableBackup<Boolean>

Enables the use of the Volume Shadow Copy service to back up a virtual machine if the virtual machine is deployed on a Hyper-V host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Enabled<Boolean>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableDataExchange<Boolean>

Enables the use of a key/value pair for the exchange of data between a virtual machine and the host operating system if the virtual machine is deployed on a Hyper-V host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableHeartbeat<Boolean>

Enables the use of a heartbeat (a signal emitted at regular intervals) to monitor the health of a virtual machine deployed on a Hyper-V host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableOperatingSystemShutdown<Boolean>

Enables the shut down of the operating system on a virtual machine managed by VMM from Hyper-V's management interfaces on the host if the virtual machine is deployed on a Hyper-V host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EnableTimeSync<Boolean>

Enables synchronizing the system time of a virtual machine with the system time of the operating system running on the host if the virtual machine is deployed on a Hyper-V host.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-HighlyAvailable<Boolean>

Specifies that a virtual machine will be placed on a Hyper-V host that is part of a host cluster. Configure this setting on a virtual machine, or on a template or hardware profile that will be used to create virtual machines.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InstallVirtualizationGuestServices<Boolean>

Installs virtualization guest services on a Windows-based virtual machine. By default, this parameter is set to $False and VMM installs the appropriate virtualization guest service automatically. For a virtual machine on a Hyper-V host, the virtualization guest service is called Integration Components (VMGuest.iso). For a virtual machine on a XenServer host, the virtualization guest service is called Citrix Tools for Virtual Machines (xs-tools.iso). Virtual machines on a VMware ESX host do not use a virtualization guest service.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-JobGroup<Guid>

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.

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

-MemoryMB<Int32>

Specifies, in megabytes (MB), the amount of random access memory (RAM) on the host that is allocated to a virtual machine. The default value is 512 MB. For a virtual machine on which dynamic memory is enabled (on a host running Windows Server 2008 R2 SP1 or later), use MemoryMB to specify the startup memory value.

TYPE OF HOST MAXIMUM HOST MEMORY ASSIGNABLE TO VM

------------ ------------------------------------

Hyper-V Up to 65536 MB RAM per virtual machine

VMware ESX Server 3.0.x Up to 16384 MB RAM per virtual machine

VMware ESX Server 3.5.x Up to 65532 MB RAM per virtual machine

Citrix XenServer Up to 32265 MB RAM per VM

Example format: -MemoryMB 1024

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MemoryWeight<Int32>

Indicates the priority in allocating memory to a virtual machine, relative to other virtual machines on the same host. A virtual machine with a higher setting is allocated more memory resources than a virtual machine with a lower setting.

For a host running Windows Server 2008 R2 SP1 or later, 5000 = Normal, 10000 = High, 0 = Low, 1 to 10000 = Custom.

NOTE: See the examples for a specific cmdlet to determine how that cmdlet uses this parameter.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MonitorMaximumCount<Int32>

Specifies the maximum number of monitors supported by a virtual video adapter.

Example format: -MonitorMaximumCount 3

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MonitorMaximumResolution<String>

Specifies, as a string, the value that represents the maximum possible monitor resolution of a virtual video adapter. Valid values are: "1024x768", "1280x1024", "1600x1200", "1920x1200". Default value: "1280x1024"

Example format: -MonitorResolutionMaximum "1600x1200"

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of a VMM object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NetworkUtilizationMbps<Int32>

Specifies, in megabits per second (Mbps), the amount of bandwidth on the host's network that can be used by a specific virtual machine.

Example format: -NetworkUtilization 10

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-NumLock<Boolean>

Enables the BIOS value for NumLock on a virtual machine (or on a template or hardware profile that is used to create virtual machines) on a Hyper-V host. This parameter does not apply to virtual machines on VMware ESX hosts, or on Citrix XenServer hosts.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-OperatingSystem<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".

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Owner<String>

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

Example format: -Owner "Contoso\ReneeLo"

Example format: -Owner "ReneeLo@Contoso"

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

-QuotaPoint<UInt32>

Specifies a quota that limits the number of virtual machines self-service users can deploy.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-RemoveCapabilityProfile

Removes one or more specified capability profile objects.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RemoveFromCloud

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RemoveSelfServiceUserRole<Boolean>

Removes the specified self-service user role from the permission list of the virtual machine.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsSystem

Specifies that a virtual machine on a Virtual Server host will run under the local system account. If specified, Virtual Server will not automatically start the virtual machine when the Virtual Server service starts. (This parameter does not apply to virtual machines on Hyper-V, VMware ESX or XenServer hosts because these platforms run a virtual machine under the local system account by default; you cannot change this setting on those virtualization platforms.)

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-RunAsUserCredential<PSCredential>

Specifies the guest account (domain\account) that a virtual machine on a Virtual Server host runs under. If specified, Virtual Server will automatically start a virtual machine when the Virtual Server service starts. For enhanced security, create a special account with limited permissions:

FILE TYPE MINIMUM REQUIRED PERMISSIONS FOR GUEST ACCOUNT

----------- ----------------------------------------------

.vmc file Read Data, Write Data, Execute File

.vmc folder List Folder, Write/Create File (required to save VM state)

.vhd file Read Data, Read Attributes, Read Extended Attributes,

Write Data

.vnc file Execute File, Read Data, Read Attributes, Read

(required if VM connects to a virtual network)

Note: This parameter does not apply to virtual machines on Hyper-V, VMware ESX hosts or Citrix XenServer hosts.

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

-StartAction<VMStartAction>

Specifies the behavior of a virtual machine when the virtualization service (Hyper-V, VMware, or XenServer) starts. Valid values are: AlwaysAutoTurnOnVM, NeverAutoTurnOnVM, TurnOnVMIfRunningWhenVSStopped.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-StopAction<VMStopAction>

Specifies the behavior of the virtual machine when the virtualization service (Hyper-V, VMware, or XenServer) stops. Valid values are: SaveVM, TurnOffVM, ShutdownGuestOS.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Tag<String>

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.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-UseHardwareAssistedVirtualization<Boolean>

Specifies that, for a virtual machine deployed on a Virtual Server host, hardware-assisted virtualization is used if it is available (when set to TRUE). The Virtual Server host must support AMD Virtualization (AMD-V) or Intel Virtualization Technology (Intel-VT) hardware virtualization. This parameter does not apply to virtual machines on Hyper-V hosts, VMware ESX hosts or Citrix XenServer hosts.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-UserRole<UserRole>

Specifies a user role object.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VirtualVideoAdapterEnabled<Boolean>

Enables, when set to $True, the Microsoft Synthetic 3D Virtual Video Adapter for virtual machines. You can enable the Virtual Video Adapter directly on a virtual machine, or on a template or hardware profile that will be used to create virtual machines.

REQUIRED: You can enable the Microsoft Synthetic 3D Virtual Video Adapter for a virtual machine only if that virtual machine is deployed on a host running Windows Server 2008 R2 SP1 (with the Remote Desktop Services role and Remote Desktop Virtual Graphics role service installed) or later or if the virtual machine is stored in a library in a stopped state (hardware changes to a stored virtual machine can only be made if the virtual machine does not have snapshots). Enabling the Microsoft Synthetic 3D Virtual Video Adapter on a virtual machine stored in a library will limit placement of that machine to hosts running Windows Server 2008 R2 SP1 (with the Remote Desktop Services role and Remote Desktop Virtual Graphics role service installed) or later.

Example format: -VirtualVideoAdapterEnabled $TRUE

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-VM<VM>

Specifies a virtual machine object.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-VMwareResourcePool<VmwResourcePool>

Assigns a virtual machine deployed on a VMware ESX host or a private cloud to a specific VMware resource pool.

Aliases

none

Required?

false

Position?

named

Default Value

none

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.

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.

  • VirtualMachine

Notes

  • Requires a VMM virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.

Examples

1: Specify an amount of memory for an existing virtual machine.

The first command gets the virtual machine object named VM01 and stores the object in the $VM variable.

The second determines whether the virtual machine stored in $VM is in a powered off state. If the virtual machine is not in a powered off state, the command uses the Stop-SCVirtualMachine command to power off the virtual machine. For more information about powering off a virtual machine, type: "Get-Help Stop-SCVirtualMachine -detailed".

The last command changes the memory allocated to VM01 to 1024 MB.

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> if($VM.Status -ne "PowerOff"){Stop-SCVirtualMachine -VM $VM}
PS C:\> Set-SCVirtualMachine -VM $VM -MemoryMB 1024

2: Change the user role used to manage a virtual machine for a user who belongs to multiple self-service user roles.

The first command gets the virtual machine object named VM02 from VMMServer01 and stores the object in the $VM variable.

The second command gets the user role object named ContosoSelfServiceUsers and stores the object in the $SSRole variable.

The last command specifies that members of the self-service user role called SSUserRole3 are now granted the permission to manage the VM called VM02.

NOTE: VMM uses the UserRole parameter to set which virtual machines are managed by the members of a specific self-service user role. Typically, you do not need to use the Set-SCVirtualMachine cmdlet with the UserRole parameter to configure this setting. However, if one or more users are members of multiple self-service user roles and you grant them permission to manage multiple virtual machines on the same host, you might encounter a case where you want to switch which user role is authorized to manage a particular virtual machine. This example illustrates that scenario.

PS C:\> $VM = Get-SCVirtualMachine -VMMServer "VMMServer01.Contoso.com" -Name "VM02"
PS C:\> $SSRole = Get-SCUserRole -Name "ContosoSelfServiceUsers"
PS C:\> Set-SCVirtualMachine -VM $VM -UserRole $SSRole

3. Disable time syncronization on a virtual machine used as a domain controller.

The first command stores the current setting for $ErrorActionPreference in variable $EAP. This variable will be used later to return the setting to its original value.

The second command sets the action preference to STOP. This error action preference changes an error from a non-terminating error to a terminating error. The error object is thrown as an exception instead of being written to the output pipe, and the command does not continue to run.

The third command gets the virtual machine object named VM03 and stores the object in the $VM variable.

The fourth command disables the time syncronization setting. Typically, disabling time synchronization is required for virtual machines that act as domain controllers. The command uses the trap statement to catch terminating exceptions. If the Set-SCVirtualMachine command fails, the string in the trap statement is displayed. Continue is used in the trap statement to continue running instead of exiting. The Out-Null cmdlet redirects the output to $Null instead of sending it to the console.

The last command sets the value for $ErrorActionPreference to the value stored in $EAP.

PS C:\> $EAP = $ErrorActionPreference
PS C:\> $ErrorActionPreference = "STOP"
PS C:\> $VM = Get-SCVirtualMachine -Name "VM03"
PS C:\> trap{"Fail: Cannot disable Time Synchronization for VM: $VM";continue} Set-SCVirtualMachine -VM $VM -EnableTimeSynchronization $TRUE | Out-Null
PS C:\> $ErrorActionPreference = $EAP

4. Set the device boot order for all virtual machines that support this feature.

The first command stores the current setting for $ErrorActionPreference in $EAP. This variable will be used later to return the setting to its original value.

The second command sets the error action preference to Stop. This error action preference changes an error from a non-terminating error to a terminating error. The error object is thrown as an exception instead of being written to the output pipe, and the command does not continue to run.

The third command gets each virtual machine object stores the objects in $VMs. Using the '@' symbol and parentheses ensures that the command stores the results in an array in case the command returns a single object or a null value.

The fourth command sets the BIOS boot order for each virtual machine to PXEBoot,IDEHarddrive,CD,Floppy. The command uses trap statement to catch terminating exceptions. If the Set-SCVirtualMachine command fails, the string in the trap statement is displayed. Continue is used in the trap statement to continue running instead of exiting the foreach loop. The Out-Null cmdlet redirects the output to $Null instead of sending it to the console.

NOTE: The BootOrder parameter is used only for virtual machines on Hyper-V and Citrix XenServer hosts; it is not used for virtual machines on VMware ESX hosts. XenServer hosts do not support floppy disks, and therefore will ignore "Floppy" if listed in the boot order.

The last command sets the value for $ErrorActionPreference to the value stored in EAP.

For more information about the standard Windows PowerShell foreach loop statement, type: "Get-Help about_ForEach".

PS C:\> $EAP = $ErrorActionPreference
PS C:\> $ErrorActionPreference = "Stop"
PS C:\> $VMs = @(Get-SCVirtualMachine)
PS C:\> foreach($VM in $VMs){trap{"Fail: Cannot set BIOS for VM: $VM";continue} Set-SCVirtualMachine -VM $VM -BootOrder "PXEBoot","IDEHarddrive","CD","Floppy" | Out-Null}
PS C:\> $ErrorActionPreference = $EAP

5: Specify an owner for all virtual machines without an owner.

This command gets all virtual machine objects on VMMServer01, selects only those virtual machine objects where no owner is listed, and specifies an owner for each virtual machine.

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

6: Enable Dynamic Memory for an existing virtual machine.

The first command gets the virtual machine object VM06 and stores object in the $VM variable. To enable Dynamic Memory on a virtual machine, the virtual machine must reside on a host that is running Windows Server 2008 R2 SP1 or later.

The second command determines whether the virtual machine stored in $VM is in a powered off state. If the virtual machine is not in a powered off state, the command uses the Stop-SCVirtualMachine command to power off the virtual machine. For more information about powering off a virtual machine, type: "Get-Help Stop-SCVirtualMachine -detailed".

The last command enables Dynamic Memory, sets the startup memory to 1024 MB (this is the amount of memory on the host that will be allocated to VM06 upon startup) and the maximum memory to 2048 MB (this is the maximum amount of memory on the host that will be allocated to VM06).

PS C:\> $VM = Get-SCVirtualMachine -Name "VM06"
PS C:\> if($VM.Status -ne "PowerOff"){Stop-SCVirtualMachine -VM $VM}
PS C:\> Set-SCVirtualMachine -VM $VM -DynamicMemoryEnabled $True -MemoryMB 1024 -DynamicMemoryMaximumMB 2048

Move-SCVirtualMachine

New-SCVirtualMachine

Read-SCVirtualMachine

Remove-SCVirtualMachine

Repair-SCVirtualMachine

Resume-SCVirtualMachine

Save-SCVirtualMachine

Start-SCVirtualMachine

Stop-SCVirtualMachine

Suspend-SCVirtualMachine