I am trying to get details for VM's from both my primary virtual center and my backup site. The backup site has both VM's and SRM placeholders. A Get-VM returns both VMs and the placeholders. I would like to only have the details of the VMs. I thought this statement would get me what I was looking for, but it doesn't return any results.
Get-VM | where ($_.ExtensionData.Config.ManagedBy.Type -ne "placeholderVm")
any help with how to do this would be appreciated.
Provided you didn't set a custom extension key for SRM placeholders, you could test for the extensionKey property
Get-VM | where {$_.ExtensionData.Config.ManagedBy.extensionKey -notmatch "com.vmware.vcDr"}
An alternative is to query the DB directly, see Determine VMs in a SRM recovery plan using PowerShell
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Provided you didn't set a custom extension key for SRM placeholders, you could test for the extensionKey property
Get-VM | where {$_.ExtensionData.Config.ManagedBy.extensionKey -notmatch "com.vmware.vcDr"}
An alternative is to query the DB directly, see Determine VMs in a SRM recovery plan using PowerShell
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
@LucD
Both our statements worked when I replaced the ( and ) with { and }
Silly mistake. Just needed an extra set of eyes to catch that
Get-VM | where {$_.ExtensionData.Config.ManagedBy.extensionKey -notmatch "com.vmware.vcDr"}
Get-VM | where {$_.ExtensionData.Config.ManagedBy.Type -ne "placeholderVm"}
Thanks for the link for the SRM scripting. Might need that soon, but for now I am just trying to exclude the placeholders from my list of VMs
Just for others looking at this thread, I corrected the error in my code above
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference