I am working on powercli 5.5 release 1e and i run the following command to get a list of vm under a hypervisor server:-
Get-VM
now i got many useful info such as :-
powerState Version Description Notes Guest NumCpu MemoryMB MemoryGB HardDisks NetworkAdapters UsbDevices CDDrives FloppyDrives Host HostId VMHostId VMHost VApp FolderId Folder ResourcePoolId ResourcePool PersistentId UsedSpaceGB ProvisionedSpaceGB DatastoreIdList HARestartPriority HAIsolationResponse DrsAutomationLevel VMSwapfilePolicy VMResourceConfiguration Name CustomFields ExtensionData Id Uid Client
but is there a way to know if a vm is a SRM replica or not using Get-VM command or other commands?
now i am calling the power cli scripts (Get-VM) from my Visual Studio , so the replicated vm appear on one hypervisor server as follow (when it is PoweredOn):-
while the same replicated vm will appear under another hyper visor server as follow (it is poweroff):-
now i have noted that the replicated vm when it is powered off will have zero harddisk & zero CDDrive... so can this give an indication that it is SRM replica vm ? or i can not depend my indication on this as any vm which is poweroff regardless if it is a SRM replica or not will have any zero hardisk and zero CDDrive assigned to it ? can anyone adivce ?
EDIT
now i investigated the returned vales for the two VMs and i found a value named Datastore, now when the vm is on it will have something such as :-
IP*****:/vol/v002_***01_nfs02
while when it is off it will have something such as (where the word srmph is included ):-
IP*****:/vol/v011_***01_srmph_nfs01
so can i depend my indication if the vm is a SRM replica from its datastore ? so if the datasotre contain the word srmph then it is a vm replica ?
Thanks
Could you try the following script from RvdNieuwendijk
https://communities.vmware.com/message/2495721#2495721
To retrieve all of the virtual machines that are not SRM placeholders, you can use the following PowerCLI command:
Get-VM | Where-Object {$_.ExtensionData.Config.ManagedBy.ExtensionKey -ne 'com.vmware.vcDr'}
To retrieve only the SRM placeholders virtual machines, you can use the following PowerCLI command:
Get-VM | Where-Object {$_.ExtensionData.Config.ManagedBy.ExtensionKey -eq 'com.vmware.vcDr'}