vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
754 stars 603 forks source link

New-HVFarm fails when $maxSessionsType is set to "LIMITED" as it is incorrectly being set in line 2786 #400

Closed kchoudhury closed 2 years ago

kchoudhury commented 3 years ago

For vmware.hv.helper module , the function New-HVFarm is incorrectly setting the $maxSessionsType for the $farmspecobject due to which if you pass the $maxSessionsType parameter value to LIMITED the api request sent is incorrect and sets the $maxsession value instead of $maxSessionsType:

Problem lies in line number 2786 -

$farmSpecObj.AutomatedFarmSpec.RdsServerMaxSessionsData.MaxSessionsType = $maxSessionsType
        if ($maxSessionsType -eq "LIMITED") {
            $farmSpecObj.AutomatedFarmSpec.RdsServerMaxSessionsData.MaxSessionsType = $maxSessions
        }

Correct code should be to set MaxSessions in this condition as given below:

$farmSpecObj.AutomatedFarmSpec.RdsServerMaxSessionsData.MaxSessionsType = $maxSessionsType
        if ($maxSessionsType -eq "LIMITED") {
            $farmSpecObj.AutomatedFarmSpec.RdsServerMaxSessionsData.MaxSessions = $maxSessions
        }
bitszor commented 3 years ago

Can confirm the fix in the original issue will allow farms to be provisioned with max sessions set to limited after above pull request is merged.

kamennikolov commented 2 years ago

Fixed by https://github.com/vmware/PowerCLI-Example-Scripts/pull/412