13 Replies Latest reply on Dec 10, 2019 2:31 AM by LucD

    Using PowerCLI to ensure CpuAffinityList is empty...

    StephenMoll Hot Shot

      I have been asked to look into providing one of our software teams with details on some PowerCLI commands to do some specific things.


      One of these was to ensure that the CpuAffinityList on VMs was empty.


      In the WebClient I can clear the "Scheduling Affinity" field, as per the information from the help dialogue.

      If I then do :


      Get-VM -Name $VMName | Get-VMResourceConfiguration | select CpuAffinityList


      I get nothing in return as expected, I just get a column header:




      If I do:


      Get-VM -Name $VMName | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuAffinityList ''

      The Webclient will now show the "Scheduling Affinity" field will now have a "0" in it. Which according to the help information would give the vCPU of the VM affinity to processor 0, whereas what I actual want is to have no specified affinity.


      This would to be at odds with the online help.


      How do I clear the CPU affinity list using PowerCLI?


      I have tried:

      get-vm -name $VMName | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuAffinityList ([string]::Empty)


      That gave the same result.