Automation

 View Only
  • 1.  SRM recovery plans VMs report

    Posted Apr 07, 2020 12:22 PM

    I am unable to pull the SRm recovery plan vms FinalPowerState . Thanks for advance..

    Using below code form https://github.com/benmeadowcroft/SRM-Cmdlets/blob/master/Examples/ReportConfiguration.ps1

    SRM-Cmdlets/ReportConfiguration.ps1 at master · benmeadowcroft/SRM-Cmdlets · GitHub

    Get-SrmProtectionGroup PGname | %{

           $pg = $_

            $pginfo = $pg.GetInfo()

            $pvms = Get-SrmProtectedVM -ProtectionGroup $pg

            $rps = Get-SrmRecoveryPlan -ProtectionGroup $pg

            $rpnames = $rps | %{ $_.GetInfo().Name }

            $pvms | %{

                $pvm = $_

                if ($srmMajorVersion -ge 6 -or ($srmMajorVersion -eq 5 -and $srmMinorVersion -eq 8))

                 {

                    $rs = $rps | Select -First 1 | %{ $_.GetRecoverySettings($pvms.Vm.MoRef) }

                }

                $output = "" | select group, name, moRef, needsConfiguration, state, plans, priority, finalPowerState, preCallouts, postCallouts

                $output.group = $pginfo.Name

                $output.name = $pvm.Vm.Name

                $output.moRef = $pvm.Vm.MoRef # this is necessary in case we can't retrieve the name when VC is unavailable

                $output.needsConfiguration = $pvm.NeedsConfiguration

                $output.state = $pvm.State

                $output.plans = [string]::Join(",`r`n", $rpnames)

                if ($rs) {

                    $output.priority = $rs.RecoveryPriority

                    $output.finalPowerState = $rs.FinalPowerState

                    $output.preCallouts = $rs.PrePowerOnCallouts.Count

                    $output.postCallouts = $rs.PostPowerOnCallouts.Count

                }

                $output

            }

        }



  • 2.  RE: SRM recovery plans VMs report
    Best Answer

    Posted Apr 07, 2020 12:41 PM

    Are you sure $rs gets a value?

    Perhaps adds an else-block where you show that for a protectiongroup there was no $rs.

    This looks like the issue reported in SRM 8.1 PowerCli and API code

    But no solution mentioned I'm afraid



  • 3.  RE: SRM recovery plans VMs report

    Posted Apr 07, 2020 02:13 PM

    Thanks Lucd. its working..