Forum Discussion

ahinterl's avatar
ahinterl
Copper Contributor
Aug 22, 2023

New-ClusterAffinityRule: cmdlet not recognized

Several *-clusteraffinityrule cmdlets are described in MS articles, but I cannot use either of them, PS reports that the respective cmdlet is not recognized. Is there a special module I need to install first?

    • ahinterl's avatar
      ahinterl
      Copper Contributor

      Hi Harm_Veenstra, thank you for your answer.

       

      Unfortunately, your advice didn't help as I already have the RSAT failover cluster module installed (I can check by successfully running:

       

       

      get-cluster -name <clustername>

       

       

      which is a cmdlet provided by FailoverClusters according to the manual.

      In fact, I have all Windows RSAT capabilities installed on my machine; looks like none of them provides any of the 'new' cmdlets:

       

       

      New-ClusterAffinityRule
      Set-ClusterAffinityRule
      Get-ClusterAffinityRule
      Add-ClusterGroupToAffinityRule
      Add-ClusterSharedVolumeToAffinityRule
      Remove-ClusterAffinityRule
      Remove-ClusterGroupFromAffinityRule
      Remove-ClusterSharedVolumeFromAffinityRule

       

       

      described in the MS article Create server and site affinity rules for VMs.

       

      The article shows how to use Windows Admin Center (WAC) for managing basic affinity rules, too. I saw the menu item some weeks ago in WAC, but MS seems to have eliminated it in a newer version 'cause I cannot find it anymore in my WAC GUI.

       

      I must admit that I have some trouble understanding the AntiAffinityClassNames property:

       

      While MS describe it as being of type System.Collections.Specialized.StringCollection (that's what I can read on other pages dealing with how to set affinity rules as well),

       

       

      Get-ClusterGroup -Cluster 'atndfhcicl01' | get-member -Name 'AntiAffinityClassNames' | fl *

       

       

      gives me:

      TypeName : Deserialized.Microsoft.FailoverClusters.PowerShell.ClusterGroup
      Name : AntiAffinityClassNames
      MemberType : Property
      Definition : Deserialized.System.String[] {get;set;}

      To my understanding, this is a little different to the term string collection—but hey, I'm not that expert regarding .net and C++ classes...

       

      The MS article AntiAffinityClassNames gives me the impression that I can simply assign a string (array? In the command result above, there are those brackets after Deserialized.System.String...) value to the AntiAffinityClassNames property of affected virtual machines (VMs) to define an anti-affinity 'rule'.

       

      It would help me a lot if someone could tell me what MS article I can 'trust', and whether it's really that simple to create an affinity rule. In the end, all I want is to avoid two special VMs to run on the same cluster node...

      • LainRobertson's avatar
        LainRobertson
        Silver Contributor

        ahinterl Harm_Veenstra 

         

        Azure Stack HCI is its own operating system, as the subscription model-based replacement for Hyper-V Server (which was free.)

         

        Unless you're running the Azure Stack HCI hypervisor, you will not see these commandlets.

         

        Cheers,

        Lain

Resources