Set-VM

Set-VM

Configures a virtual machine.

Sintaxe

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

Descrição detalhada

The Set-VM cmdlet configures a virtual machine.

Parâmetros

-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. Os valores aceitáveis para esse parâmetro são: Pause and None.

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-AutomaticStartAction<StartAction]>

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-AutomaticStartDelay<Int32]>

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

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

Allows you to configure the type of checkpoints created by Hyper-V. Os valores aceitáveis para esse parâmetro são:

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

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

Executa o cmdlet em uma sessão remota ou em um computador remoto. Insira um nome de computador ou um objeto de sessão, como a saída de um cmdlet New-CimSession ou Get-CimSession. O padrão é a sessão atual no computador local.

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-DynamicMemory

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-GuestControlledCacheTypes<System.Boolean>

Specifies whether this virtual machine uses guest controlled cache types.

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

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

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-Name<String[]>

Specifies the name of the virtual machine to be configured.

Aliases

VMName

Obrigatório?

true

Posição?

1

Valor padrão

none

Aceitar entrada de pipeline?

True (ByValue)

Aceitar caracteres curinga?

false

-NewVMName<String>

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-Passthru

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-ProcessorCount<Int64]>

Specifies the number of virtual processors for the virtual machine.

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-SnapshotFileLocation<String>

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-VM<VirtualMachine[]>

Specifies the virtual machine to be configured.

Aliases

none

Obrigatório?

true

Posição?

1

Valor padrão

none

Aceitar entrada de pipeline?

True (ByValue)

Aceitar caracteres curinga?

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

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-SmartPagingFilePath<String>

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

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-Notes<String>

Specifies notes to be associated with the virtual machine.

Aliases

none

Obrigatório?

false

Posição?

named

Valor padrão

none

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-Confirm

Solicita confirmação antes de executar o cmdlet.

Obrigatório?

false

Posição?

named

Valor padrão

false

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

-WhatIf

Mostra o que ocorreria se o cmdlet fosse executado. O cmdlet não é executado.

Obrigatório?

false

Posição?

named

Valor padrão

false

Aceitar entrada de pipeline?

false

Aceitar caracteres curinga?

false

<CommonParameters>

Esse cmdlet oferece suporte aos parâmetros comuns: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer e -OutVariable. Para obter mais informações, consulte  about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

O tipo de entrada é o tipo dos objetos que você pode redirecionar para o cmdlet.

Saídas

O tipo de saída é o tipo de objeto que o cmdlet emite.

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

Exemplos

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