共用方式為


Get-AzureSiteRecoveryProtectionEntity

取得 Site Recovery 保存庫中可保護或受保護的實體。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

Get-AzureSiteRecoveryProtectionEntity
   -ProtectionContainer <ASRProtectionContainer>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureSiteRecoveryProtectionEntity
   -Id <String>
   -ProtectionContainer <ASRProtectionContainer>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureSiteRecoveryProtectionEntity
   -Id <String>
   -ProtectionContainerId <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureSiteRecoveryProtectionEntity
   -Name <String>
   -ProtectionContainer <ASRProtectionContainer>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureSiteRecoveryProtectionEntity
   -Name <String>
   -ProtectionContainerId <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]
Get-AzureSiteRecoveryProtectionEntity
   -ProtectionContainerId <String>
   [-Profile <AzureSMProfile>]
   [<CommonParameters>]

Description

Get-AzureSiteRecoveryProtectionEntity Cmdlet 會在目前的 Azure Site Recovery 保存庫中取得可保護或受保護的實體,例如虛擬機。

範例

範例 1:在容器中顯示受保護的虛擬機

PS C:\> $Container = Get-AzureSiteRecoveryProtectionContainer
PS C:\> Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $Container 
ID                           : 43aaab46-1cb0-4c39-8077-9a091c3b05ce
ServerId                     : 4a94c4a9-c856-4577-afbd-367fe9b3ce9c
ProtectionContainerId        : 4a94c4a9-c856-4577-afbd-367fe9b3ce9c_1c513d45-645d-4ed0-b9ae-e7b869a1f7fc
Name                         : testvm
Type                         : VirtualMachine
FabricObjectId               : 506B3CAC-5758-49E2-98C4-E5B0512E4D8E
Protected                    : False
CanCommit                    : False
CanFailover                  : False
CanReverseReplicate          : False
ActiveLocation               : Primary
ProtectionStateDescription   : Enabling protection
ReplicationHealth            : 
TestFailoverStateDescription : Nonev
ReplicationProvider          : HyperVReplica

第一個命令會使用 Get-AzureSiteRecoveryProtectionContainer Cmdlet 取得受保護的容器,然後將該物件儲存在 $Container 變數中。

第二個命令會取得屬於 $Container 中容器的受保護虛擬機,然後顯示它。

參數

-Id

指定要取得的保護實體標識碼。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Name

指定要取得的保護實體名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ProtectionContainer

指定保護容器。

類型:ASRProtectionContainer
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ProtectionContainerId

指定受保護容器的標識碼。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False