SRM-Cmdlets icon indicating copy to clipboard operation
SRM-Cmdlets copied to clipboard

SRM Report_Powershell

Open piyushranu opened this issue 4 years ago • 0 comments

For SRM am trying to get below details

  1. vm name even if it shows as UID or any ID
  2. protection group with there respective group
  3. last sync time
  4. last sync data size
  5. protection datastorage
  6. sync from PROD to DR site 7.any error

i used below script but not getting all details. what am missing in both lines. guide me

Get-SrmProtectionGroup | %{ $pg = $_ Get-SrmProtectedVM -ProtectionGroup $pg } | %{ $output = "" | select VmName, PgName $output.VmName = $.Vm.Name $output.PgName = $pg.GetInfo().Name $output } | Format-Table @{Label="VM Name"; Expression={$.VmName} }, @{Label="Protection group name"; Expression={$_.PgName} }

and in one of script am getting below error

$VMname = Get-VM -id $($OneDetail.MoRef) $Status = $OneDetail.Overallstatus $Details = @{ VMname = $VMname ProtectionGroup = $ProtectionGroup Description = $Description Type = $Type Datastore = $Datastore Descriptio = $Description Status = $Status

error code after that Get-VM : 5/22/2020 10:18:50 AM Get-VM VM with id 'VirtualMachine-vm-272891' was not found using the specified filter(s).
At line:40 char:23

  •         $VMname = Get-VM -id $($OneDetail.MoRef)
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
    • FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Get-VM : 5/22/2020 10:18:53 AM Get-VM VM with id 'VirtualMachine-vm-67421' was not found using the specified filter(s).
At line:40 char:23

  •         $VMname = Get-VM -id $($OneDetail.MoRef)
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
    • FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM Get-VM : 5/22/2020 10:18:50 AM Get-VM VM with id 'VirtualMachine-vm-272891' was not found using the specified filter(s).
      At line:40 char:23
  •         $VMname = Get-VM -id $($OneDetail.MoRef)
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
    • FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

Get-VM : 5/22/2020 10:18:53 AM Get-VM VM with id 'VirtualMachine-vm-67421' was not found using the specified filter(s).
At line:40 char:23

  •         $VMname = Get-VM -id $($OneDetail.MoRef)
    
  •                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ObjectNotFound: (:) [Get-VM], VimException
    • FullyQualifiedErrorId : Core_OutputHelper_WriteNotFoundError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

piyushranu avatar May 23 '20 06:05 piyushranu