Edit

Share via


Set-VM

Configures a virtual machine.

Syntax

Name (Default)

Set-VM
    [-Name] <String[]>
    [-CimSession <CimSession[]>]
    [-ComputerName <String[]>]
    [-Credential <PSCredential[]>]
    [-GuestControlledCacheTypes <Boolean>]
    [-LowMemoryMappedIoSpace <UInt32>]
    [-HighMemoryMappedIoSpace <UInt64>]
    [-ProcessorCount <Int64>]
    [-DynamicMemory]
    [-StaticMemory]
    [-MemoryMinimumBytes <Int64>]
    [-MemoryMaximumBytes <Int64>]
    [-MemoryStartupBytes <Int64>]
    [-AutomaticStartAction <StartAction>]
    [-AutomaticStopAction <StopAction>]
    [-AutomaticStartDelay <Int32>]
    [-AutomaticCriticalErrorAction <CriticalErrorAction>]
    [-AutomaticCriticalErrorActionTimeout <Int32>]
    [-AutomaticCheckpointsEnabled <Boolean>]
    [-LockOnDisconnect <OnOffState>]
    [-Notes <String>]
    [-NewVMName <String>]
    [-SnapshotFileLocation <String>]
    [-SmartPagingFilePath <String>]
    [-CheckpointType <CheckpointType>]
    [-Passthru]
    [-AllowUnverifiedPaths]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

VMObject

Set-VM
    [-VM] <VirtualMachine[]>
    [-GuestControlledCacheTypes <Boolean>]
    [-LowMemoryMappedIoSpace <UInt32>]
    [-HighMemoryMappedIoSpace <UInt64>]
    [-ProcessorCount <Int64>]
    [-DynamicMemory]
    [-StaticMemory]
    [-MemoryMinimumBytes <Int64>]
    [-MemoryMaximumBytes <Int64>]
    [-MemoryStartupBytes <Int64>]
    [-AutomaticStartAction <StartAction>]
    [-AutomaticStopAction <StopAction>]
    [-AutomaticStartDelay <Int32>]
    [-AutomaticCriticalErrorAction <CriticalErrorAction>]
    [-AutomaticCriticalErrorActionTimeout <Int32>]
    [-AutomaticCheckpointsEnabled <Boolean>]
    [-LockOnDisconnect <OnOffState>]
    [-Notes <String>]
    [-NewVMName <String>]
    [-SnapshotFileLocation <String>]
    [-SmartPagingFilePath <String>]
    [-CheckpointType <CheckpointType>]
    [-Passthru]
    [-AllowUnverifiedPaths]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-VM cmdlet configures a virtual machine.

Examples

Example 1

PS C:\> Set-VM -Name TestVM -AutomaticStopAction Shutdown

Configures virtual machine TestVM to shut down when the Hyper-V host shuts down.

Example 2

PS C:\> Stop-VM -Name TestVM -Passthru | Set-VM -ProcessorCount 2 -DynamicMemory -MemoryMaximumBytes 2GB -Passthru | Start-VM

Stops virtual machine TestVM, sets it to use dynamic memory, sets its maximum amount of memory to 2GB, sets it to use 2 virtual processors, and starts it.

Parameters

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticCheckpointsEnabled

Specifies whether automatic checkpoints are enabled.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticCriticalErrorAction

Specifies the action to take when the VM encounters a critical error, and exceeds the timeout duration specified by the AutomaticCriticalErrorActionTimeout cmdlet. The acceptable values for this parameter are: Pause and None.

Parameter properties

Type:CriticalErrorAction
Default value:None
Accepted values:None, Pause
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticCriticalErrorActionTimeout

Specifies the amount of time, in minutes, to wait in critical pause before powering off the virtual machine.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticStartAction

Specifies the action the virtual machine is to take upon start. Allowed values are Nothing, StartIfRunning, and Start.

Parameter properties

Type:StartAction
Default value:None
Accepted values:Nothing, StartIfRunning, Start
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticStartDelay

Specifies the number of seconds by which the virtual machine's start should be delayed.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-AutomaticStopAction

Specifies the action the virtual machine is to take when the virtual machine host shuts down. Allowed values are TurnOff, Save, and ShutDown.

Parameter properties

Type:StopAction
Default value:None
Accepted values:TurnOff, Save, ShutDown
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CheckpointType

Allows you to configure the type of checkpoints created by Hyper-V. The acceptable values for this parameter are:

  • Disabled. Block creation of checkpoints.
  • Standard. Create standard checkpoints.
  • Production. Create production checkpoints if supported by guest operating system. Otherwise, create standard checkpoints.
  • ProductionOnly. Create production checkpoints if supported by guest operating system. Otherwise, the operation fails.

Parameter properties

Type:CheckpointType
Default value:None
Accepted values:Disabled, Production, ProductionOnly, Standard
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Parameter properties

Type:

CimSession[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Name
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ComputerName

Specifies one or more Hyper-V hosts on which the virtual machine 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.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Name
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Credential

Specifies one or more user accounts that have permission to perform this action. The default is the current user.

Parameter properties

Type:

PSCredential[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Name
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DynamicMemory

Specifies that the virtual machine is to be configured to use dynamic memory.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-GuestControlledCacheTypes

Specifies whether this virtual machine uses guest controlled cache types.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-HighMemoryMappedIoSpace

The Set-VM cmdlet configures a virtual machine.

Parameter properties

Type:UInt64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LockOnDisconnect

Specifies whether virtual machine connection in basic mode locks the console after a user disconnects.

Parameter properties

Type:OnOffState
Default value:None
Accepted values:On, Off
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-LowMemoryMappedIoSpace

The Set-VM cmdlet configures a virtual machine.

Parameter properties

Type:UInt32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MemoryMaximumBytes

Specifies the maximum amount of memory that the virtual machine is to be allocated. (Applies only to virtual machines using dynamic memory.)

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MemoryMinimumBytes

Specifies the minimum amount of memory that the virtual machine is to be allocated. (Applies only to virtual machines using dynamic memory.)

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-MemoryStartupBytes

Specifies the amount of memory that the virtual machine is to be allocated upon startup. (If the virtual machine does not use dynamic memory, then this is the static amount of memory to be allocated.)

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

Specifies the name of the virtual machine to be configured.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False
Aliases:VMName

Parameter sets

Name
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-NewVMName

Specifies the name to which the virtual machine is to be renamed.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Notes

Specifies notes to be associated with the virtual machine.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Passthru

Specifies that an object is to be passed through to the pipeline representing the virtual machine to be configured.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ProcessorCount

Specifies the number of virtual processors for the virtual machine.

Parameter properties

Type:Int64
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SmartPagingFilePath

Specifies the folder in which the Smart Paging file is to be stored.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-SnapshotFileLocation

Specifies the folder in which the virtual machine is to store its snapshot files.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-StaticMemory

This cmdlet configures the virtual machine to use static memory. Specify the amount of static memory to allocate by using the MemoryStartupBytes parameter.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VM

Specifies the virtual machine to be configured.

Parameter properties

Type:

VirtualMachine[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

VMObject
Position:0
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

None

Default

Microsoft.HyperV.PowerShell.VirtualMachine

If -PassThru is specified.