The following script is supposed to get the virtual machines in a virtual machine DRS group. It displays the DRS group name, but not the virtual machines.
# Follow-up to https://developercenter.vmware.com/forums?id=2530#471518
Write-Output
"Start of script $($MyInvocation.MyCommand.Name). $(get-date -Format O)"get-cluster
<font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2">-Name</font></font></font>$ClusterName).ExtensionData.ConfigurationEx.group) |ForEach
{where-object
{ $_.gettype().name-eq"ClusterVmGroup"}foreach
{get-vm
<font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2">-id</font></font></font>$_}New-Object
<font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2">-TypeName</font></font></font>PSObject<font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2"><font color="#5f9ea0" face="SimHei" size="2">-Property</font></font></font>$VirtualmachineDrsGroupPropertiesOut-Default
Out-Default
Write-Output
"End of script $($MyInvocation.MyCommand.Name). $(get-date -Format O)"Have a look at Matt's Backup/Export Full DRS Rule Info via PowerShell
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference