VMware Cloud Community
piyushranusri
Enthusiast
Enthusiast

SRM Report Module

Powershell script the line. highlighted line. any suggestion what am missing here?

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

getting error

============

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

0 Kudos
4 Replies
LucD
Leadership
Leadership

I think the error message is quite clear, the cmdlet can not find a VM with the ID VirtualMachine-vm-272891


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
piyushranusri
Enthusiast
Enthusiast

i compared the report with Vm name, actually there is no vm name  its hows as some numbers or vm not found. after more analysis i found that those vms are no longer on PROD SRM site but still it showing on DR SRM configuration.

any suggestion how can be say like show me anything either its number of or any data on the place of vm name (if vm name is not proper)

am about to close this SRM report only this point is pending. after that will share the full script here.

0 Kudos
CRad14
Hot Shot
Hot Shot

If you already have the MoRef of the VM, why not use that instead of VMName?

Conrad www.vnoob.com | @vNoob | If I or anyone else is helpful to you make sure you mark their posts as such! 🙂
0 Kudos
piyushranusri
Enthusiast
Enthusiast

CRad14
actually not sure how to fetch that info. any suggestion

0 Kudos