PowerCLI

 View Only
  • 1.  PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 27, 2017 11:04 AM

    Hi Folks,

    I was hoping for some guidance. I would like to be able to use powercli to check if individual VMs, or a group of VMs, are part of a DRS group.

    I have been unable to find a one liner or script that will do this. Does anyone have one, or a link to one?

    Much appreciated.



  • 2.  RE: PowerCLi - Check if VM is a member of a DRS group
    Best Answer

    Posted Sep 27, 2017 11:14 AM

    Is this providing the info you are looking for?

    Get-VM |

    Select Name,@{N='DRSGroup';E={$script:group = Get-DrsClusterGroup -VM $_; $script:group.Name}},

        @{N='GroupType';E={$script:group.GroupType}}



  • 3.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 27, 2017 12:42 PM

    Thanks for the response.

    This seems to be leaving the 'DRSGroup' and 'GroupType' fields blank. I have verified that the few servers I've tried are in a VM DRS Group. Any further thoughts?

    Get-VM VM |

    Select Name,@{N='DRSGroup';E={$script:group = Get-DrsClusterGroup -VM $_; $script:group.Name}},

        @{N='GroupType';E={$script:group.GroupType}}

    Name                     DRSGroup      GroupType

    ----                          --------                ---------

    VM                 



  • 4.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 27, 2017 12:42 PM

    Which PowerCLI version are you using?

    Can you do a Get-PowerCLIVersion



  • 5.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 27, 2017 12:51 PM

    VMware vSphere PowerCLI 6.3 Release 1 build 3737840

    Also tried on ISE

    PS C:\Windows\system32> $PSVersionTable.PSVersion

    Major  Minor  Build  Revision

    -----  -----  -----  --------

    5      0      10586  117    



  • 6.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 27, 2017 01:01 PM

    That is the issue, you need at least PowerCLI 6.5R1 to have the Get-Get-DrsClusterGroup cmdlet.

    Can you upgrade your PowerCLI?

    If not, we can have a solution based on the DrsRule module.



  • 7.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 28, 2017 09:21 AM

    I have upgraded my powercli but the Get-DrsClusterGroup cmdlet doesn't appear to be available. Can only see Get-DrsRule and Get-DrsRecommendation.



  • 8.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 28, 2017 09:26 AM

    Can you check if you are the same module version as me?

    If that doesn't return anything, do a

    Get-Module -Name VMware.VimAutomation.Core

    to see which version of the module you have



  • 9.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 28, 2017 09:36 AM

    The Get-Command -Name Get-DrsClusterGroup didn't return anything.

    It's a bit blurry but the Get-Module -Name VMware.VimAutomation.Core gave me a version of 6.5.0.2...

    I download this version from: Download VMware vSphere



  • 10.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 28, 2017 09:40 AM

    That's the difference, the last two releases only are available on the PowerShell Gallery.

    See Welcome PowerCLI to the PowerShell Gallery – Install Process Updates

    PS: although it works in PowerShell v4, it is advisable to go for PowerShell v5.1



  • 11.  RE: PowerCLi - Check if VM is a member of a DRS group

    Posted Sep 28, 2017 10:34 AM

    That's it now, I've managed to get it working.

    Thanks very much for your help on this, really appreciate it!