Uredi

Dijelite putem


Get-AzVM

Gets the properties of a virtual machine.

Syntax

ListAllVirtualMachinesParamSet (Default)

Get-AzVM
    [-Status]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ListVirtualMachineInResourceGroupParamSet

Get-AzVM
    [-ResourceGroupName] <String>
    [-Status]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

GetVirtualMachineInResourceGroupParamSet

Get-AzVM
    [-ResourceGroupName] <String>
    [-Name] <String>
    [-Status]
    [-DisplayHint <DisplayHintType>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

ListNextLinkVirtualMachinesParamSet

Get-AzVM
    [-NextLink] <Uri>
    [-Status]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Get-AzVM cmdlet gets the model view and instance view of an Azure virtual machine. The model view is the user specified properties of the virtual machine. The instance view is the instance level status of the virtual machine. Specify the Status parameter to get only the instance view of a virtual machine.

Examples

Example 1: Get model and instance view properties

PS C:\> Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07"

This command gets the model view and instance view properties of the virtual machine named VirtualMachine07.

Example 2: Get instance view properties

PS C:\> Get-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine07" -Status

This command gets properties of the virtual machine named VirtualMachine07. This command specifies the Status parameter. Therefore, the command gets only the instance view properties.

Example 3: Get properties for all virtual machines in a resource group

PS C:\> Get-AzVM -ResourceGroupName "ResourceGroup11"

This command gets properties for all the virtual machines in the resource group named ResourceGroup11.

Example 4: Get all virtual machines in your subscription

PS C:\> Get-AzVM

This command gets all the virtual machines in your subscription.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DisplayHint

Determines how the virtual machine object is displayed.

Valid values are:

-- Compact: displays only top level properties

Parameter properties

Type:DisplayHintType
Default value:None
Accepted values:Compact, Expand
Supports wildcards:False
DontShow:False

Parameter sets

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

-Name

Specifies the name of the virtual machine to get.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:ResourceName, VMName

Parameter sets

GetVirtualMachineInResourceGroupParamSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

Specifies the next link.

Type:Uri
Default value:None
Supports wildcards:False
DontShow:False
ListNextLinkVirtualMachinesParamSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of a resource group.

Parameter properties

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

Parameter sets

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

-Status

Indicates that this cmdlet gets only the instance view of the virtual machine.

Parameter properties

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

Parameter sets

(All)
Position:2
Mandatory:False
Value from pipeline:False
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.

Inputs

None

This cmdlet does not accept any input.

Outputs

PSVirtualMachine

PSVirtualMachineInstanceView