共用方式為


Get-AzureVM

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Get-AzureVM

Retrieves information from one or more Azure virtual machines.

Syntax

Parameter Set: GetVMByServiceAndVMName
Get-AzureVM [-ServiceName] <String> [[-Name] <String> ] [ <CommonParameters>]

Detailed Description

This topic describes the cmdlet in the 0.8.10 version of the Microsoft Azure PowerShell module. To get the version of the module you're using, in the Azure PowerShell console, type (Get-Module -Name Azure).Version.

The Get-AzureVM cmdlet retrieves information about virtual machines running in Azure. It returns an object with information on a specific virtual machine, or if no virtual machine is specified, for all the virtual machines in the specified service of the current subscription.

Parameters

-Name<String>

Specifies the name of the virtual machine for which to retrieve information. If this parameter is not provided, the cmdlet returns a list object with information about all the virtual machines in the specified service.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ServiceName<String>

The name of the cloud service for which to return virtual machine information.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

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.

Examples

Example 1

This command returns an object with information on the "MyVM1" virtual machine running in the "MySvc1" cloud service.

C:\PS> Get-AzureVM -ServiceName "MySvc1" -Name "MyVM1"

Example 2

This command retrieves a list object with information on all of the virtual machines running in the "MySvc1" cloud service.

C:\PS> Get-AzureVM -ServiceName "MySvc1" 

Example 3

This command displays a table showing the virtual machines running on the "MySvc1" service, their Upgrade Domain, and the current status of each machine.

C:\PS> Get-AzureVM -ServiceName "MySvc1" `
| Format-Table –auto "Name",@{Expression={$_.InstanceUpgradeDomain};Label="UpgDom";Align="Right"},"InstanceStatus"

New-AzureVMConfig

Remove-AzureVM

Restart-AzureVM

Start-AzureVM

Stop-AzureVM

Update-AzureVM

New-AzureVM