PowerCLI

 View Only
Expand all | Collapse all

DRS VM Overrides

  • 1.  DRS VM Overrides

    Posted Oct 30, 2019 08:15 AM

    I have several VM with names: app, db and etc.

    How I can change DRS VM overrides using PowerCLI?



  • 2.  RE: DRS VM Overrides

    Posted Oct 30, 2019 08:21 AM

    You can use the Set-VM cmdlet with the DrsAutomationLevel parameter.

    Something like this

    Get-VM -Name app | Set-VM -DrsAutomationLevel Disabled -Confirm:$false


  • 3.  RE: DRS VM Overrides

    Posted Oct 30, 2019 08:59 AM

    How can I get current VM overrides settings for VM, in (Get-VM -Name app).DrsAutomationLevel  - no information



  • 4.  RE: DRS VM Overrides

    Posted Oct 30, 2019 09:03 AM

    When there is no explicit setting for a VM, it should say 'AsSpecifiedByCluster', in other words, the cluster default.

    Which PowerCLI version are you using?
    Do a

    Get-Module -Name VMware.PowerCLI -ListAvailable



  • 5.  RE: DRS VM Overrides

    Posted Oct 30, 2019 09:05 AM

    -------------------------    Importetd Module   -------------------------

       Get-FunctionVersion                      -    0.0.-1.

       Microsoft.PowerShell.Management          -    3.1.0.

       Microsoft.PowerShell.Security            -    3.0.0.

       Microsoft.PowerShell.Utility             -    3.1.0.

       New-PercentageBar                        -    0.0.-1.

       PowerNSX                                 -    3.0.1118.

       PSReadline                               -    1.2.-1.

       Start-SleepProgress                      -    0.0.-1.

       VAMI                                     -    2.0.0.

       vDocumentation                           -    2.4.0.

       Vi-Module                                -    1.4.7.

       Vi-SDRS                                  -    0.0.-1.

       VMware.Community.CISTag                  -    1.0.0.

       VMware.DeployAutomation                  -    6.7.0.

       VMware.ImageBuilder                      -    6.7.0.

       VMware.PowerCLI                          -    11.5.0.

       VMware.Vim                               -    6.7.0.

       VMware.VimAutomation.Cis.Core            -    11.5.0.

       VMware.VimAutomation.Cloud               -    11.0.0.

       VMware.VimAutomation.Common              -    11.5.0.

       VMware.VimAutomation.Core                -    11.5.0.

       VMware.VimAutomation.Hcx                 -    11.5.0.

       VMware.VimAutomation.HorizonView         -    7.10.0.

       VMware.VimAutomation.License             -    11.3.0.

       VMware.VimAutomation.Nsxt                -    11.5.0.

       VMware.VimAutomation.PCloud              -    10.0.0.

       VMware.VimAutomation.Sdk                 -    11.5.0.

       VMware.VimAutomation.Security            -    11.0.0.

       VMware.VimAutomation.Srm                 -    11.5.0.

       VMware.VimAutomation.Storage             -    11.5.0.

       VMware.VimAutomation.StorageUtility      -    1.3.0.

       VMware.VimAutomation.Vds                 -    11.2.0.

       VMware.VimAutomation.Vmc                 -    11.5.0.

       VMware.VimAutomation.vROps               -    10.0.0.

       VMware.VumAutomation                     -    6.5.1.

       vNugglets.Utility                        -    1.2.0.

       Write-Menu                               -    0.0.-1.

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



  • 6.  RE: DRS VM Overrides

    Posted Oct 30, 2019 09:07 AM

    That's the latest version.
    And the following is not returning 'AsSpecifiedByCluster'?

    Get-VM -Name app | Select Name,DrsAutomationLevel


  • 7.  RE: DRS VM Overrides

    Posted Oct 30, 2019 10:04 AM

    PS C:\> Get-VM -Name app | Select Name,DrsAutomationLevel

    Name DrsAutomationLevel

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

    app             Manual

    but I do not see these parameters


  • 8.  RE: DRS VM Overrides

    Posted Oct 30, 2019 10:14 AM

    That property indeed only shows the value of the Automation level field.

    If you need to report on other settings, you will have to go into the ExtensionData property.



  • 9.  RE: DRS VM Overrides

    Posted Oct 30, 2019 10:17 AM

    Can you tell me which ExtensionData you need to watch?

    Maybe an example?



  • 10.  RE: DRS VM Overrides

    Posted Oct 30, 2019 10:19 AM

    Which properties do you want to report on?



  • 11.  RE: DRS VM Overrides

    Posted Oct 30, 2019 10:28 AM



  • 12.  RE: DRS VM Overrides
    Best Answer

    Posted Oct 30, 2019 10:59 AM

    Several of these are HA settings, not DRS.
    But in any case, you could do something like this

    $clusterName = 'cluster'

    Get-Cluster -Name $clusterName -PipelineVariable cluster |

    Get-VM -PipelineVariable vm |

    Select @{N='Cluster';E={$cluster.Name}},

        @{N='VM';E={$_.Name}},

        @{N='DRS Automation Level';E={$_.DrsAutomationLevel}},

        @{N='VM Restart Priority';E={$_.HARestartPriority}},

        @{N='Additional Delay';E={

            $script:orch = $cluster.ExtensionData.ConfigurationEx.VmOrchestration |

                where{$_.Vm -eq $vm.ExtensionData.MoRef} |

                Select -ExpandProperty VmReadiness

            if(-not $script:orch){

                $script:orch = $cluster.ExtensionData.ConfigurationEx.Orchestration.DefaultVmReadiness

            }

            $script:orch.PostReadyDelay}},

        @{N='After Timeout';E={

            $script:ha = $cluster.ExtensionData.ConfigurationEx.DasVmConfig |

                where{$_.Key -eq $vm.ExtensionData.MoRef} |

                Select -ExpandProperty DasSettings

            if(-not $script:ha){

                $script:ha = $cluster.ExtensionData.ConfigurationEx.DasConfig.DefaultVmSettings

            }

            $script:ha.RestartPriorityTimeout}},

        @{N='Host Isolation';E={$_.HAIsolationResponse}},

        @{N='Permanent Device Loss';E={$script:ha.VmComponentProtectionSettings.VmStorageProtectionForPDL}}



  • 13.  RE: DRS VM Overrides

    Posted Oct 30, 2019 11:24 AM

    Thank you for what you need!



  • 14.  RE: DRS VM Overrides

    Posted Oct 30, 2019 12:33 PM

    Everything turned out to be simpler, you can use the "code capture", which is in vSphere HTML5 Web Client

    vSphere HTML5 Web Client | VMware Flings



  • 15.  RE: DRS VM Overrides

    Posted Oct 30, 2019 12:43 PM

    I don't see how this is related?
    Code Capture provides code for a single view of 1 VM, not the logic to get the values for all VMs in a cluster.



  • 16.  RE: DRS VM Overrides

    Posted Jan 15, 2021 05:06 PM

    Hello:

    Regarding this same topic, can someone provide some guidance on how to set parameters for VM Overrides using powercli ? Like say VM Readiness - Ready condition to poweredOn for example ?



  • 17.  RE: DRS VM Overrides