你调用的对象是空的。运行命令Get-AzureRmRecoveryServicesAsrRecoveryPlan时出错

时间:2018-04-19 05:21:33

标签: powershell azure

对象引用未设置为对象的实例。

运行命令Get-AzureRmRecoveryServicesAsrRecoveryPlan ...

时出错
 PS C:\WINDOWS\system32> $rpname = "myrecoveryplan"
    $recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $rpname

    Get-AzureRmRecoveryServicesAsrRecoveryPlan : Operation failed.
    Object reference not set to an instance of an object.
    At line:2 char:13
    + $recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $rpname
    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : CloseError: (:) [Get-AzureRmReco...AsrRecoveryPlan], Exception
        + FullyQualifiedErrorId : Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.GetAzureRmRecoveryS 
       ervicesAsrRecoveryPlan

1 个答案:

答案 0 :(得分:0)

我已经更新了我的powershell,它似乎正在继续。但我得到了另一个拦截器。 $ Context = Set-AzureRmRecoveryServicesAsrVaultContext -Vault $ Vault $ recoplan = Get-AzureRmRecoveryServicesAsrRecoveryPlan -Name $ rpname Start-AzureRmSiteRecoveryTestFailoverJob -RecoveryPlan $ recoplan -Direction“PrimaryToRecovery”-VMNetwork“asrtestfailtarget” Start-AzureRmSiteRecoveryTestFailoverJob:无法绑定参数'RecoveryPlan'。无法转换 “Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRRecoveryPlan”类型的值 键入“Microsoft.Azure.Commands.RecoveryServices.SiteRecovery.ASRRecoveryPlan” “Microsoft.Azure.Commands.SiteRecovery.ASRRecoveryPlan”。 在行:5 char:56 + ... rt-AzureRmSiteRecoveryTestFailoverJob -RecoveryPlan $ recoplan -Direct ... + ~~~~~~~~~     + CategoryInfo:InvalidArgument:(:) [Start-AzureRmSiteRecoveryTestFailoverJob],参数    BindingException     + FullyQualifiedErrorId:CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.SiteRecovery.Start    AzureRmSiteRecoveryTestFailoverJob