Set-VM

Set-VM

Configures a virtual machine.

構文

Parameter Set: Name
Set-VM [-Name] <String[]> [-AllowUnverifiedPaths] [-AutomaticCriticalErrorAction <Nullable [Microsoft.HyperV.PowerShell.CriticalErrorAction]> ] [-AutomaticCriticalErrorActionTimeout <Nullable [System.Int32]> ] [-AutomaticStartAction <StartAction]> ] [-AutomaticStartDelay <Int32]> ] [-AutomaticStopAction <StopAction]> ] [-CheckpointType <Nullable [Microsoft.HyperV.PowerShell.CheckpointType]> ] [-CimSession <Microsoft.Management.Infrastructure.CimSession[]> ] [-ComputerName <String[]> ] [-Credential <System.Management.Automation.PSCredential[]> ] [-DynamicMemory] [-GuestControlledCacheTypes <System.Boolean> ] [-LockOnDisconnect <Nullable [Microsoft.HyperV.PowerShell.OnOffState]> ] [-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] [-AutomaticCriticalErrorAction <Nullable [Microsoft.HyperV.PowerShell.CriticalErrorAction]> ] [-AutomaticCriticalErrorActionTimeout <Nullable [System.Int32]> ] [-AutomaticStartAction <StartAction]> ] [-AutomaticStartDelay <Int32]> ] [-AutomaticStopAction <StopAction]> ] [-CheckpointType <Nullable [Microsoft.HyperV.PowerShell.CheckpointType]> ] [-DynamicMemory] [-GuestControlledCacheTypes <System.Boolean> ] [-LockOnDisconnect <Nullable [Microsoft.HyperV.PowerShell.OnOffState]> ] [-MemoryMaximumBytes <Int64]> ] [-MemoryMinimumBytes <Int64]> ] [-MemoryStartupBytes <Int64]> ] [-NewVMName <String> ] [-Notes <String> ] [-Passthru] [-ProcessorCount <Int64]> ] [-SmartPagingFilePath <String> ] [-SnapshotFileLocation <String> ] [-StaticMemory] [-Confirm] [-WhatIf] [ <CommonParameters>]

詳細説明

The Set-VM cmdlet configures a virtual machine.

パラメーター

-AutomaticCriticalErrorAction<Nullable [Microsoft.HyperV.PowerShell.CriticalErrorAction]>

Specifies the action to take when the VM encounters a critical error, and exceeds the timeout duration specified by the AutomaticCriticalErrorActionTimeout cmdlet. このパラメーターに指定できる値は、次のとおりです。 Pause and None.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-AutomaticCriticalErrorActionTimeout<Nullable [System.Int32]>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-AutomaticStartAction<StartAction]>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-AutomaticStartDelay<Int32]>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-CheckpointType<Nullable [Microsoft.HyperV.PowerShell.CheckpointType]>

Allows you to configure the type of checkpoints created by Hyper-V. このパラメーターに指定できる値は、次のとおりです。

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-CimSession<Microsoft.Management.Infrastructure.CimSession[]>

リモート セッションまたはリモート コンピューターでコマンドレットを実行します。コンピューター名またはセッション オブジェクト (New-CimSession コマンドレットや Get-CimSession コマンドレットの出力など) を入力します。既定値は、ローカル コンピューター上の現在のセッションです。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Credential<System.Management.Automation.PSCredential[]>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-DynamicMemory

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-GuestControlledCacheTypes<System.Boolean>

Specifies whether this virtual machine uses guest controlled cache types.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-LockOnDisconnect<Nullable [Microsoft.HyperV.PowerShell.OnOffState]>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Name<String[]>

Specifies the name of the virtual machine to be configured.

Aliases

VMName

必須/オプション

true

位置

1

既定値

none

パイプライン入力の受け入れ

True (ByValue)

ワイルドカード文字の受け入れ

false

-NewVMName<String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Passthru

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-ProcessorCount<Int64]>

Specifies the number of virtual processors for the virtual machine.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SnapshotFileLocation<String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

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.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-VM<VirtualMachine[]>

Specifies the virtual machine to be configured.

Aliases

none

必須/オプション

true

位置

1

既定値

none

パイプライン入力の受け入れ

True (ByValue)

ワイルドカード文字の受け入れ

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

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-SmartPagingFilePath<String>

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

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Notes<String>

Specifies notes to be associated with the virtual machine.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-Confirm

コマンドレットを実行する前に確認メッセージを表示します。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

-WhatIf

コマンドレットが実行された場合に何が起きるのかを示します。コマンドレットは実行されません。

必須/オプション

false

位置

named

既定値

false

パイプライン入力の受け入れ

false

ワイルドカード文字の受け入れ

false

<CommonParameters>

このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

出力

出力型は、コマンドレットが出力するオブジェクトの型です。

  • None by default; Microsoft.HyperV.PowerShell.VirtualMachine if –PassThru is specified.

使用例

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