Quantcast
Channel: VMware Communities : Discussion List - Site Recovery Manager
Viewing all articles
Browse latest Browse all 3691

SRM Reporting_Powersehell

$
0
0

Can some one share me working script for SRM reporting where i can export

protection group, vm name, any error and last sync date and sync size.  is this correct what am trying. we do have 15 datacenter, i know that will take some time. So that is not an issue.

Import-Module VMware.VimAutomation.Vds
Import-Module-Name "C:\Windows\addins\SRM\SRM-Cmdlets-master\Meadowcroft.Srm.Protection.ps1"
$vcenterip=
foreach ($vcenterin$vcenterip){
Write-Output'Before connecting'
Connect-VIServer-Server "$vcenter"-User xxxxxxxx -Password xxxxxxxx
Write-Output"Connected to $vcenter"
$logfolder="C:\Windows\addins\SRM\Results\"
#connect-viserver -Server $vcenter -username $vcuser -password $vcpass|out-null
#Connect-SrmServer |out-null
$srmapi=$defaultsrmservers.ExtensionData
$srmpgs=$srmapi.protection.listprotectiongroups()
for ($i=0; $i-lt$srmpgs.Count; $i++)
{
$vms=$srmpgs[$i].ListProtectedVMs()
$pgvms= [array] "Virtual Machine list:"
for ($a=0; $a-lt$vms.Count; $a++)
{
 
$vm=get-vm-ID $vms[$a].VM.MoRef
$pgvms+=$vm.Name
}
$pgname=$srmapi.protection.listprotectiongroups()[$i].GetInfo().Name
add-content$logfile"==================================================================================="
add-content$logfile"******************************Next Protection Group********************************"
add-content$logfile"==================================================================================="
$text="The following "+$vms.Count+" virtual machines are in the Protection Group named "+$pgname
add-content$logfile$text
add-content$logfile$pgvms
}
disconnect-viserver-Server $vcenter-confirm:$false
$report|Export-Csv-NoTypeInformation "$outputfile"

Viewing all articles
Browse latest Browse all 3691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>