SRM-Cmdlets
SRM-Cmdlets copied to clipboard
SRM Report_Powershell
For SRM am trying to get below details
- vm name even if it shows as UID or any ID
- protection group with there respective group
- last sync time
- last sync data size
- protection datastorage
- 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