共用方式為


Read-SCVirtualMachine

Refreshes the properties of a virtual machine so that the VMM console displays updated information about the virtual machine.

Syntax

FullRefreshSingleVm (Default)

Read-SCVirtualMachine
    [-VM] <VM>
    [-Force]
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

LightRefreshVmsOnHost

Read-SCVirtualMachine
    [-VMHost] <Host>
    [-RunAsynchronously]
    [-PROTipID <Guid>]
    [-JobVariable <String>]
    [-OnBehalfOfUser <String>]
    [-OnBehalfOfUserRole <UserRole>]
    [<CommonParameters>]

Description

The Read-SCVirtualMachine cmdlet updates the properties of a virtual machine so that the Virtual Machine Manager (VMM) console displays updated information about the virtual machine. The updated properties include Name, Status, Host, Owner, CPUAverage, Service, OperatingSystem, and other properties.

Examples

Example 1: Refresh information about a specific virtual machine

PS C:\> $VM = Get-SCVirtualMachine -Name "VM01"
PS C:\> Read-SCVirtualMachine -VM $VM

The first command gets the virtual machine object named VM01, and then stores that object in the $VM variable.

The second command updates the properties of the virtual machine stored in $VM. After this command finishes successfully, it displays current information about this virtual machine.

Example 2: Refresh all virtual machines on hosts whose name matches the specified string

PS C:\> $VMs = Get-SCVirtualMachine -VMMServer "VMMServer01.Contoso.com" | Where-Object { $_.VMHost.Name -Match "VMM" }
PS C:\> $VMs | Read-SCVirtualMachine

The first command gets all virtual machine objects from VMMServer01 deployed on hosts whose name contains the string VMM, and then stores those virtual machine objects in the $VMs array.

The second command updates the properties of each virtual machine object stored in $VMs.

Parameters

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

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

Parameter sets

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

-JobVariable

Specifies a variable in which job progress is tracked and 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

-OnBehalfOfUser

Specifies a user name. This cmdlet operates on behalf of the user that this parameter specifies.

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

-OnBehalfOfUserRole

Specifies a user role. To obtain a user role, use the Get-SCUserRole cmdlet. This cmdlet operates on behalf of the user role that this parameter specifies.

Parameter properties

Type:UserRole
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

-PROTipID

Specifies the ID of the Performance and Resource Optimization tip (PRO tip) that triggered this action. This parameter lets you audit PRO tips.

Parameter properties

Type:Guid
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

-RunAsynchronously

Indicates that the job runs asynchronously so that control returns to the command shell immediately.

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 a virtual machine object.

Parameter properties

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

Parameter sets

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

-VMHost

Specifies a virtual machine host object. VMM supports Hyper-V hosts, VMware ESX hosts, and Citrix XenServer hosts.

For more information about each type of host, see the Add-SCVMHost cmdlet.

Parameter properties

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

Parameter sets

LightRefreshVmsOnHost
Position:0
Mandatory:True
Value from pipeline:True
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

VirtualMachine

Notes

  • This cmdlet requires a virtual machine object, which can be retrieved by using the Get-SCVirtualMachine cmdlet.