Hi all
Maybe someone know why this command does not work.
$CLS = Get-Cluster XXX
Get-DrsRule -Cluster $CLS
Thanks in advance for your help.
If you want to use the vSphere objects instead of the .NET objects, that is your choice.
Isn't using the Type parameter exactly what I have been telling you.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD.
When there are no DRS rules in that cluster, the cmdlet doesn't return anything
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
Thanks for your message.
There are some rules on cluster.
These commands return the rules.
foreach($vm in Get-VM -Location $CLS){
Get-DrsRule -Cluster $CLS -VM $vm -Type VMHostAffinity
}
Only the Cluster parameter is a required parameter.
Just tested that and it works for me.
Which PowerCLI and vSphere version are you using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD
That is not the latest version, but should be ok.
So the following is not returning anything for you?
Get-DrsRule -Cluster cluster
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
it does not work for me.
Are you perhaps trying to see VMHostAffinity rules?
Without Type or VMHost parameter you don't get those.
As the Get-DrsRule cmdlet clearly states:
Note: To retrieve VMHostAffinity rules, you need to state this explicitly by using the Type or the VMHost parameter. Otherwise, this cmdlet returns VMAffinity and VMAntiAffinity rules.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I want to return all type of DRS rules.
That is not what I asked.
If you RTFM, you will see that you have to use the Type or VMHost parameter to retrieve the VMHostAffinityRules.
If you do not use those parameters, the cmdlet will only return VMAffinity and VMAntiAffinity rules.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
what do you think about this one:
$CLS.ExtensionData.ConfigurationEx.Rule
or
Get-DrsRule -Cluster $CLS -Type VMHostAffinity,VMAntiAffinity,VMAffinity
If you want to use the vSphere objects instead of the .NET objects, that is your choice.
Isn't using the Type parameter exactly what I have been telling you.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD.
Hi LucD,
I'm trying to run Get-DrsRule cmdlet, but the results not showing the VMID's (these rules are correctly configured through GUI)
PS C:\> Get-Drsrule -cluster "NAMED2" -Type VMHostAffinity
Name Enabled Type VMIDs
---- ------- ---- -----
VMs must be in SiteA True VMHostAffinity
VMs must be in SiteB True VMHostAffinity
VMs should in SiteA True VMHostAffinity
VMs should in SiteB True VMHostAffinity
MYM VMs should be in SiteB True VMHostAffinity
I've tried create new rules through New-DrsClusterGroup cmdlet like this:
New-DrsClusterGroup -Name "Hosts-TEST" -Cluster "NAMED3" -VMHost vnamed1a.local,vnamed3a.local
And I can see this rules through GUI, but get-drsclustergroup cmdlet not shows any results...
PS C:\> Get-DrsClusterGroup
PS C:\>
I need to get the list of the VMs in each VM Host rules.
I would really appreciate your help, thanks
Check what the cluster configuration says about the groups and rules
$clusterName = 'NAMED2'
$cluster = Get-Cluster -Name $clusterName
$cluster.ExtensionData.ConfigurationEx.Group
$cluster.ExtensionData.ConfigurationEx.Rule
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That seems to indicate there are no VM or VMHost groups defined for that cluster.
Strange that you seen them in the Web Client
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
In the previous snippet we used the vSphere API directly (ExtensionData), so most probably has nothing to do with PowerCLI.
There could be an issue in vSphere.
I suggest opening an SR.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD, we've just upgrade PowerCLI to the last version and both commands now works properly. Thanks fou your help.