Set-VM
Set-VM
Configures a virtual machine.
Syntax
Parameter Set: Name
Set-VM [-Name] <String[]> [-AllowUnverifiedPaths] [-AutomaticStartAction <StartAction> ] [-AutomaticStartDelay <Int32> ] [-AutomaticStopAction <StopAction> ] [-ComputerName <String[]> ] [-DynamicMemory] [-MemoryMaximumBytes <Int64> ] [-MemoryMinimumBytes <Int64> ] [-MemoryStartupBytes <Int64> ] [-NewVMName <String> ] [-Notes <String> ] [-Passthru] [-ProcessorCount <Int64> ] [-SmartPagingFilePath <String> ] [-SnapshotFileLocation <String> ] [-StaticMemory] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: VMObject
Set-VM [-VM] <VirtualMachine[]> [-AllowUnverifiedPaths] [-AutomaticStartAction <StartAction> ] [-AutomaticStartDelay <Int32> ] [-AutomaticStopAction <StopAction> ] [-DynamicMemory] [-MemoryMaximumBytes <Int64> ] [-MemoryMinimumBytes <Int64> ] [-MemoryStartupBytes <Int64> ] [-NewVMName <String> ] [-Notes <String> ] [-Passthru] [-ProcessorCount <Int64> ] [-SmartPagingFilePath <String> ] [-SnapshotFileLocation <String> ] [-StaticMemory] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Set-VM cmdlet configures a virtual machine.
Parameters
-AutomaticStartAction<StartAction>
Specifies the action the virtual machine is to take upon start. Allowed values are Nothing, StartIfRunning, and Start.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AutomaticStartDelay<Int32>
Specifies the number of seconds by which the virtual machine’s start should be delayed.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-AutomaticStopAction<StopAction>
Specifies the action the virtual machine is to take when the virtual machine host shuts down. Allowed values are TurnOff, Save, and ShutDown.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ComputerName<String[]>
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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
. |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-DynamicMemory
Specifies that the virtual machine is to be configured to use dynamic memory.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MemoryMaximumBytes<Int64>
Specifies the maximum amount of memory that the virtual machine is to be allocated. (Applies only to virtual machines using dynamic memory.)
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MemoryMinimumBytes<Int64>
Specifies the minimum amount of memory that the virtual machine is to be allocated. (Applies only to virtual machines using dynamic memory.)
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-MemoryStartupBytes<Int64>
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.)
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Name<String[]>
Specifies the name of the virtual machine to be configured.
Aliases |
VMName |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-NewVMName<String>
Specifies the name to which the virtual machine is to be renamed.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Passthru
Specifies that an object is to be passed through to the pipeline representing the virtual machine to be configured.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-ProcessorCount<Int64>
Specifies the number of virtual processors for the virtual machine.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SnapshotFileLocation<String>
Specifies the folder in which the virtual machine is to store its snapshot files.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-StaticMemory
Specifies the amount of static memory for the virtual machine.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-VM<VirtualMachine[]>
Specifies the virtual machine to be configured.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByValue) |
Accept Wildcard Characters? |
false |
-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.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-SmartPagingFilePath<String>
Specifies the folder in which the Smart Paging file is to be stored.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Notes<String>
Specifies notes to be associated with the virtual machine.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
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, -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.
- None by default; Microsoft.Virtualization.Powershell.VirtualMachine if –PassThru is specified.
Examples
Example 1
Configures virtual machine TestVM to shut down when the Hyper-V host shuts down.
PS C:\> Set-VM –Name TestVM –AutomaticStopAction Shutdown
Example 2
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.
PS C:\> Stop-VM -Name TestVM -Passthru | Set-VM -ProcessorCount 2 -DynamicMemory -MemoryMaximumBytes 2GB -Passthru | Start-VM