Edit

Share via


Get-AzureSiteRecoveryVM

Gets information about Site Recovery-managed virtual machines.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

ByObject (Default)

Get-AzureSiteRecoveryVM
    -ProtectionContainer <ASRProtectionContainer>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByObjectWithId

Get-AzureSiteRecoveryVM
    -Id <String>
    -ProtectionContainer <ASRProtectionContainer>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByIDsWithId

Get-AzureSiteRecoveryVM
    -Id <String>
    -ProtectionContainerId <String>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByObjectWithName

Get-AzureSiteRecoveryVM
    -Name <String>
    -ProtectionContainer <ASRProtectionContainer>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByIDsWithName

Get-AzureSiteRecoveryVM
    -Name <String>
    -ProtectionContainerId <String>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

ByIDs

Get-AzureSiteRecoveryVM
    -ProtectionContainerId <String>
    [-Profile <AzureSMProfile>]
    [<CommonParameters>]

Description

The Get-AzureSiteRecoveryVM cmdlet gets information about virtual machines managed in Azure Site Recovery.

Examples

Example 1: Get information about a virtual machine

PS C:\> $ProtectionContainer = Get-AzureSiteRecoveryProtectionContainer
PS C:\> Get-AzureSiteRecoveryVM -ProtectionContainer $ProtectionContainer
ID                          : a205fd17-3848-4896-bab6-9dbccc3cd8ed
ServerId                    : 4a94c4a9-c856-4577-afbd-367fe9b3ce9c
ProtectionContainerId       : 4a94c4a9-c856-4577-afbd-367fe9b3ce9c_1c513d45-645d-4ed0-b9ae-e7b869a1f7fc
Name                        : vm1
Type                        : VirtualMachine
FabricObjectId              : 00001111-aaaa-2222-bbbb-3333cccc4444
Protected                   : False
CanCommit                   : False
CanFailover                 : True
CanReverseReplicate         : False
ActiveLocation              : Primary
ProtectionState             : Enabled
ReplicationHealth           : Healthy
TestFailoverState           : None
ReplicationProvider         : HyperVReplica

The first command uses the Get-AzureSiteRecoveryProtectionContainer cmdlet to get a protected container, and then stores it in the $ProtectionContainer variable.

The second command gets information about the virtual machines in $ProtectionContainer.

Parameters

-Id

Specifies the ID of the virtual machine about which to get information.

Parameter properties

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

Parameter sets

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

-Name

Specifies the name of the virtual machine.

Parameter properties

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

Parameter sets

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

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Parameter properties

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

-ProtectionContainer

Specifies the Site Recovery protection container object.

Parameter properties

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

Parameter sets

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

-ProtectionContainerId

Specifies the ID of a protected container about which to get information.

Parameter properties

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

Parameter sets

ByIDsWithId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIDsWithName
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
ByIDs
Position:Named
Mandatory:True
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.