< Back
Set-VM
Post
NAME Set-VM
SYNOPSIS
This cmdlet modifies the configuration of the virtual machine.
SYNTAX
Set-VM [-VM] <VirtualMachine[]> [-AlternateGuestName <String>] [-CoresPerSocket <Int32>] [-DrsAutomationLevel
{Disabled | FullyAutomated | Manual | PartiallyAutomated | AsSpecifiedByCluster}] [-GuestId <String>]
[-HAIsolationResponse {AsSpecifiedByCluster | PowerOff | DoNothing | Shutdown}] [-HardwareVersion <String>]
[-HARestartPriority {Disabled | Low | Medium | High | ClusterRestartPriority | Lowest | Highest}] [-MemoryGB
<Decimal>] [-MemoryMB <Int64>] [-Name <String>] [-Notes <String>] [-NumCpu <Int32>] [-OSCustomizationSpec
<OSCustomizationSpec>] [-RunAsync] [-Server <VIServer[]>] [-Version {Unknown | v4 | v7 | v8 | v9 | v10 | v11 | v12
| v13 | v14}] [-VMSwapFilePolicy {WithVM | Inherit | InHostDatastore}] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> -DisableEncryption [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-DrsAutomationLevel {Disabled | FullyAutomated | Manual | PartiallyAutomated |
AsSpecifiedByCluster}] [-HAIsolationResponse {AsSpecifiedByCluster | PowerOff | DoNothing | Shutdown}]
[-HARestartPriority {Disabled | Low | Medium | High | ClusterRestartPriority | Lowest | Highest}] [-Name <String>]
[-OSCustomizationSpec <OSCustomizationSpec>] [-RunAsync] [-Server <VIServer[]>] [-Snapshot <Snapshot>]
[-VMSwapFilePolicy {WithVM | Inherit | InHostDatastore}] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-KmsCluster <KmsCluster>] [-RunAsync] [-Server <VIServer[]>] [-SkipHardDisks]
[-StoragePolicy <StoragePolicy>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-Name <String>] [-RunAsync] [-Server <VIServer[]>] [-ToTemplate] [-Confirm]
[-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-PromoteDisks] [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf]
[<CommonParameters>]
DESCRIPTION
This cmdlet modifies the configuration of the virtual machine. If the OSCustomizationSpec parameter is used, the
cmdlet customizes the virtual machine according to the specification. In addition, the cmdlet allows you to revert
a virtual machine to a snapshot and convert a virtual machine to a template.
PARAMETERS
-AlternateGuestName <String>
Specifies the full name of the guest OS for the virtual machine if the value of the GuestID parameter is set
to otherGuest or otherGuest64.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CoresPerSocket <Int32>
Specifies the number of virtual CPU cores per socket.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DisableEncryption [<SwitchParameter>]
Indicates that the cmdlet is to decrypt the specified virtual machine.
Required? true
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DrsAutomationLevel <DrsAutomationLevel>
Specifies a DRS (Distributed Resource Scheduler) automation level. The valid values are FullyAutomated,
Manual, PartiallyAutomated, AsSpecifiedByCluster, and Disabled. Passing values to this parameter through a
pipeline is deprecated and will be disabled in a future release. Specifying this parameter is only supported
when the virtual machine is inside a cluster. Otherwise, an error is generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-GuestId <String>
Specifies the guest operating system of the virtual machine. The valid values for specific ESX versions are
listed in the description of the VirtualMachineGuestOsIdentifier enumeration type in the vSphere API Reference
available at http://www.vmware.com/support/developer/vc-sdk/. Depending on the hardware configuration of the
host, some of the guest operating systems might be inapplicable.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HAIsolationResponse <HAIsolationResponse>
Indicates whether the virtual machine should be powered off if a host determines that it is isolated from the
rest of the compute resource. The valid values are AsSpecifiedByCluster, PowerOff, and DoNothing. Passing
values to this parameter through a pipeline is deprecated and will be disabled in a future release. Specifying
this parameter is only supported when the virtual machine is inside a cluster. Otherwise, an error is
generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HardwareVersion <String>
Specifies the version to which you want to upgrade the virtual machine. You cannot downgrade to an earlier
version.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HARestartPriority <HARestartPriority>
Specifies the virtual machine HA restart priority. The valid values are Disabled, Low, Medium, High, and
ClusterRestartPriority. VMware High Availability (HA) is a feature that detects failed virtual machines and
automatically restarts them on alternative ESX hosts. Passing values to this parameter through a pipeline is
deprecated and will be disabled in a future release. Specifying this parameter is only supported when the
virtual machine is inside a cluster. Otherwise, an error is generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-KmsCluster <KmsCluster>
Specifies the KmsCluster which will be used to generate a key for encrypting the virtual machine. If
StoragePolicy is not specified then the default encryption storage policy "VM Encryption Policy" is used.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-MemoryGB <Decimal>
Specifies the memory size in gigabytes (GB).
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-MemoryMB <Int64>
This parameter is obsolete. Use MemoryGB instead. Specifies the memory size in megabytes (MB).
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Name <String>
Specifies a new name for the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Notes <String>
Provides a description for the virtual machine. The alias of this parameter is Description.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NumCpu <Int32>
Specifies the number of virtual CPUs.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OSCustomizationSpec <OSCustomizationSpec>
Specifies a customization specification you want to apply to the virtual machine. This works only in 32-bit
mode.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PromoteDisks [<SwitchParameter>]
Promotes virtual machine disks. This parameter can be used to promote linked clone virtual machine to full
clone.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-RunAsync [<SwitchParameter>]
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the
output of the cmdlet is a Task object. For more information about the RunAsync parameter, run "help
About_RunAsync" in the VMware PowerCLI console.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of the Connect-VIServer cmdlet.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SkipHardDisks [<SwitchParameter>]
Indicates the StoragePolicy or encryption (KmsCluster) will be applied to vmhome only.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Snapshot <Snapshot>
Specifies a snapshot whose state you want to apply to the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-StoragePolicy <StoragePolicy>
Specifies the StoragePolicy to attach to the specified virtual machine. If the StoragePolicy is an encryption
policy, the virtual machine will be encrypted; Otherwise, the virtual machine will be decrypted, if it's
encrypted before the cmdlet, and attached with the new StoragePolicy.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ToTemplate [<SwitchParameter>]
Indicates that you want to convert the virtual machine to a template.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Version <VMVersion>
This parameter is deprecated. Use 'HardwareVersion' parameter instead. Specifies the version to which you want
to upgrade the virtual machine. The valid values are v4, v7, v8, v9, v10, v11, v12, v13, and v14. You cannot
downgrade to an earlier version.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VM <VirtualMachine[]>
Specifies the virtual machine that you want to configure.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-VMSwapFilePolicy <VMSwapfilePolicy>
Specifies the swapfile placement policy. The following values are valid:
InHostDataStore - Stores the swapfile in the datastore specified by the VMSwapfileDatastoreID property of the
virtual machine host. If the VMSwapfileDatastoreID property is not set or indicates a datastore with
insufficient free space, the swapfile is stored in the same directory as the virtual machine. This setting
might degrade the VMotion performance.
WithVM - Stores the swapfile in the same directory as the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.
Required? false
Position? named
Default value $true
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are
modified.
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, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more modified VirtualMachine objects or the newly created Template objects
NOTES
Applying customization specs works only in 32-bit mode. Encrypt a virtual machine needs to meet several
requirements: 1) The virtual machine is powered off 2) The virtual machine has no snapshot 3) The virtual
machine isn't a linked cloned VM
-------------------------- Example 1 --------------------------
$template = Get-VM VM | Set-VM -ToTemplate -Name VMTemplate
Converts the VM virtual machine to a template and stores the template in the $template variable.
-------------------------- Example 2 --------------------------
Get-VM -Location ResourcePool01 | Set-VM -MemoryGB 2 -NumCPU 2
Upgrades the memory and CPU count of the virtual machines in ResourcePool01.
-------------------------- Example 3 --------------------------
Set-VM -VM VM -HardwareVersion vmx-07
Upgrades the virtual hardware version of the VM machine.
-------------------------- Example 4 --------------------------
$snapshot = Get-Snapshot -VM $vm -Name "Initial state"
Set-VM -VM $vm -Snapshot $snapshot
Reverts the VM virtual machine to the "Initial state" snapshot.
-------------------------- Example 5 --------------------------
$spec = Get-OSCustomizationSpec -Name FinanceDepartmentSpec;
Set-VM -VM $vm -OSCustomizationSpec $spec
Applies a customization specification on the specified virtual machines.
-------------------------- Example 6 --------------------------
Set-VM $vm -Name "Web Server" -GuestID winNetStandardGuest -Description "Company's web server"
Changes the name, description, and guest ID of the specified virtual machine.
-------------------------- Example 7 --------------------------
$kmscluster = Get-KmsCluster | select -first 1
Set-VM $vm -KmsCluster $kmscluster
Encrypts the whole virtual machine stored in $vm including its VM Home and all its valid hard disks.
-------------------------- Example 8 --------------------------
$storagepolicy = Get-SpbmStoragePolicy | select -first 1
Set-VM $vm -StoragePolicy $storagepolicy -SkipHardDisks
Attaches the $storagepolicy to the VM Home of the virtual machine $vm: - If the $storagepolicy is an encryption
policy, the VM Home of the virtual machine $vm will be encrypted.
- If the $storagepolicy is a non-encryption policy, the VM Home of the virtual machine $vm might be decrypted and
attached with the new policy if it was encrypted before this cmdlet in case it has no encrypted disks; otherwise
this cmdlet will fail.
-------------------------- Example 9 --------------------------
Set-VM $vm -DisableEncryption
Decrypts the whole virtual machine stored in $vm including its VM Home and all its valid hard disks.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... et-VM.html
Get-VM
Move-VM
New-VM
Remove-VM
Start-VM
Stop-VM
Suspend-VM
SYNOPSIS
This cmdlet modifies the configuration of the virtual machine.
SYNTAX
Set-VM [-VM] <VirtualMachine[]> [-AlternateGuestName <String>] [-CoresPerSocket <Int32>] [-DrsAutomationLevel
{Disabled | FullyAutomated | Manual | PartiallyAutomated | AsSpecifiedByCluster}] [-GuestId <String>]
[-HAIsolationResponse {AsSpecifiedByCluster | PowerOff | DoNothing | Shutdown}] [-HardwareVersion <String>]
[-HARestartPriority {Disabled | Low | Medium | High | ClusterRestartPriority | Lowest | Highest}] [-MemoryGB
<Decimal>] [-MemoryMB <Int64>] [-Name <String>] [-Notes <String>] [-NumCpu <Int32>] [-OSCustomizationSpec
<OSCustomizationSpec>] [-RunAsync] [-Server <VIServer[]>] [-Version {Unknown | v4 | v7 | v8 | v9 | v10 | v11 | v12
| v13 | v14}] [-VMSwapFilePolicy {WithVM | Inherit | InHostDatastore}] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> -DisableEncryption [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf]
[<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-DrsAutomationLevel {Disabled | FullyAutomated | Manual | PartiallyAutomated |
AsSpecifiedByCluster}] [-HAIsolationResponse {AsSpecifiedByCluster | PowerOff | DoNothing | Shutdown}]
[-HARestartPriority {Disabled | Low | Medium | High | ClusterRestartPriority | Lowest | Highest}] [-Name <String>]
[-OSCustomizationSpec <OSCustomizationSpec>] [-RunAsync] [-Server <VIServer[]>] [-Snapshot <Snapshot>]
[-VMSwapFilePolicy {WithVM | Inherit | InHostDatastore}] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-KmsCluster <KmsCluster>] [-RunAsync] [-Server <VIServer[]>] [-SkipHardDisks]
[-StoragePolicy <StoragePolicy>] [-Confirm] [-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-Name <String>] [-RunAsync] [-Server <VIServer[]>] [-ToTemplate] [-Confirm]
[-WhatIf] [<CommonParameters>]
Set-VM [-VM] <VirtualMachine[]> [-PromoteDisks] [-RunAsync] [-Server <VIServer[]>] [-Confirm] [-WhatIf]
[<CommonParameters>]
DESCRIPTION
This cmdlet modifies the configuration of the virtual machine. If the OSCustomizationSpec parameter is used, the
cmdlet customizes the virtual machine according to the specification. In addition, the cmdlet allows you to revert
a virtual machine to a snapshot and convert a virtual machine to a template.
PARAMETERS
-AlternateGuestName <String>
Specifies the full name of the guest OS for the virtual machine if the value of the GuestID parameter is set
to otherGuest or otherGuest64.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-CoresPerSocket <Int32>
Specifies the number of virtual CPU cores per socket.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-DisableEncryption [<SwitchParameter>]
Indicates that the cmdlet is to decrypt the specified virtual machine.
Required? true
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-DrsAutomationLevel <DrsAutomationLevel>
Specifies a DRS (Distributed Resource Scheduler) automation level. The valid values are FullyAutomated,
Manual, PartiallyAutomated, AsSpecifiedByCluster, and Disabled. Passing values to this parameter through a
pipeline is deprecated and will be disabled in a future release. Specifying this parameter is only supported
when the virtual machine is inside a cluster. Otherwise, an error is generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-GuestId <String>
Specifies the guest operating system of the virtual machine. The valid values for specific ESX versions are
listed in the description of the VirtualMachineGuestOsIdentifier enumeration type in the vSphere API Reference
available at http://www.vmware.com/support/developer/vc-sdk/. Depending on the hardware configuration of the
host, some of the guest operating systems might be inapplicable.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HAIsolationResponse <HAIsolationResponse>
Indicates whether the virtual machine should be powered off if a host determines that it is isolated from the
rest of the compute resource. The valid values are AsSpecifiedByCluster, PowerOff, and DoNothing. Passing
values to this parameter through a pipeline is deprecated and will be disabled in a future release. Specifying
this parameter is only supported when the virtual machine is inside a cluster. Otherwise, an error is
generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HardwareVersion <String>
Specifies the version to which you want to upgrade the virtual machine. You cannot downgrade to an earlier
version.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-HARestartPriority <HARestartPriority>
Specifies the virtual machine HA restart priority. The valid values are Disabled, Low, Medium, High, and
ClusterRestartPriority. VMware High Availability (HA) is a feature that detects failed virtual machines and
automatically restarts them on alternative ESX hosts. Passing values to this parameter through a pipeline is
deprecated and will be disabled in a future release. Specifying this parameter is only supported when the
virtual machine is inside a cluster. Otherwise, an error is generated.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-KmsCluster <KmsCluster>
Specifies the KmsCluster which will be used to generate a key for encrypting the virtual machine. If
StoragePolicy is not specified then the default encryption storage policy "VM Encryption Policy" is used.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-MemoryGB <Decimal>
Specifies the memory size in gigabytes (GB).
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-MemoryMB <Int64>
This parameter is obsolete. Use MemoryGB instead. Specifies the memory size in megabytes (MB).
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Name <String>
Specifies a new name for the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Notes <String>
Provides a description for the virtual machine. The alias of this parameter is Description.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-NumCpu <Int32>
Specifies the number of virtual CPUs.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-OSCustomizationSpec <OSCustomizationSpec>
Specifies a customization specification you want to apply to the virtual machine. This works only in 32-bit
mode.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-PromoteDisks [<SwitchParameter>]
Promotes virtual machine disks. This parameter can be used to promote linked clone virtual machine to full
clone.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-RunAsync [<SwitchParameter>]
Indicates that the command returns immediately without waiting for the task to complete. In this mode, the
output of the cmdlet is a Task object. For more information about the RunAsync parameter, run "help
About_RunAsync" in the VMware PowerCLI console.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Server <VIServer[]>
Specifies the vCenter Server systems on which you want to run the cmdlet. If no value is given to this
parameter, the command runs on the default servers. For more information about default servers, see the
description of the Connect-VIServer cmdlet.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SkipHardDisks [<SwitchParameter>]
Indicates the StoragePolicy or encryption (KmsCluster) will be applied to vmhome only.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Snapshot <Snapshot>
Specifies a snapshot whose state you want to apply to the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-StoragePolicy <StoragePolicy>
Specifies the StoragePolicy to attach to the specified virtual machine. If the StoragePolicy is an encryption
policy, the virtual machine will be encrypted; Otherwise, the virtual machine will be decrypted, if it's
encrypted before the cmdlet, and attached with the new StoragePolicy.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-ToTemplate [<SwitchParameter>]
Indicates that you want to convert the virtual machine to a template.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Version <VMVersion>
This parameter is deprecated. Use 'HardwareVersion' parameter instead. Specifies the version to which you want
to upgrade the virtual machine. The valid values are v4, v7, v8, v9, v10, v11, v12, v13, and v14. You cannot
downgrade to an earlier version.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-VM <VirtualMachine[]>
Specifies the virtual machine that you want to configure.
Required? true
Position? 0
Default value None
Accept pipeline input? True (ByValue)
Accept wildcard characters? false
-VMSwapFilePolicy <VMSwapfilePolicy>
Specifies the swapfile placement policy. The following values are valid:
InHostDataStore - Stores the swapfile in the datastore specified by the VMSwapfileDatastoreID property of the
virtual machine host. If the VMSwapfileDatastoreID property is not set or indicates a datastore with
insufficient free space, the swapfile is stored in the same directory as the virtual machine. This setting
might degrade the VMotion performance.
WithVM - Stores the swapfile in the same directory as the virtual machine.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Confirm [<SwitchParameter>]
If the value is $true, indicates that the cmdlet asks for confirmation before running. If the value is $false,
the cmdlet runs without asking for user confirmation.
Required? false
Position? named
Default value $true
Accept pipeline input? False
Accept wildcard characters? false
-WhatIf [<SwitchParameter>]
Indicates that the cmdlet is run only to display the changes that would be made and actually no objects are
modified.
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, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
Zero or more modified VirtualMachine objects or the newly created Template objects
NOTES
Applying customization specs works only in 32-bit mode. Encrypt a virtual machine needs to meet several
requirements: 1) The virtual machine is powered off 2) The virtual machine has no snapshot 3) The virtual
machine isn't a linked cloned VM
-------------------------- Example 1 --------------------------
$template = Get-VM VM | Set-VM -ToTemplate -Name VMTemplate
Converts the VM virtual machine to a template and stores the template in the $template variable.
-------------------------- Example 2 --------------------------
Get-VM -Location ResourcePool01 | Set-VM -MemoryGB 2 -NumCPU 2
Upgrades the memory and CPU count of the virtual machines in ResourcePool01.
-------------------------- Example 3 --------------------------
Set-VM -VM VM -HardwareVersion vmx-07
Upgrades the virtual hardware version of the VM machine.
-------------------------- Example 4 --------------------------
$snapshot = Get-Snapshot -VM $vm -Name "Initial state"
Set-VM -VM $vm -Snapshot $snapshot
Reverts the VM virtual machine to the "Initial state" snapshot.
-------------------------- Example 5 --------------------------
$spec = Get-OSCustomizationSpec -Name FinanceDepartmentSpec;
Set-VM -VM $vm -OSCustomizationSpec $spec
Applies a customization specification on the specified virtual machines.
-------------------------- Example 6 --------------------------
Set-VM $vm -Name "Web Server" -GuestID winNetStandardGuest -Description "Company's web server"
Changes the name, description, and guest ID of the specified virtual machine.
-------------------------- Example 7 --------------------------
$kmscluster = Get-KmsCluster | select -first 1
Set-VM $vm -KmsCluster $kmscluster
Encrypts the whole virtual machine stored in $vm including its VM Home and all its valid hard disks.
-------------------------- Example 8 --------------------------
$storagepolicy = Get-SpbmStoragePolicy | select -first 1
Set-VM $vm -StoragePolicy $storagepolicy -SkipHardDisks
Attaches the $storagepolicy to the VM Home of the virtual machine $vm: - If the $storagepolicy is an encryption
policy, the VM Home of the virtual machine $vm will be encrypted.
- If the $storagepolicy is a non-encryption policy, the VM Home of the virtual machine $vm might be decrypted and
attached with the new policy if it was encrypted before this cmdlet in case it has no encrypted disks; otherwise
this cmdlet will fail.
-------------------------- Example 9 --------------------------
Set-VM $vm -DisableEncryption
Decrypts the whole virtual machine stored in $vm including its VM Home and all its valid hard disks.
RELATED LINKS
Online Version: https://code.vmware.com/doc/preview?id= ... et-VM.html
Get-VM
Move-VM
New-VM
Remove-VM
Start-VM
Stop-VM
Suspend-VM