vmware / dscr-for-vmware

The Repository contains Microsoft PowerShell Desired State Configuration (DSC) Resources for managing VC and ESXi settings.
Other
139 stars 41 forks source link

VMHostAccount DSC Resource doesn't change account password on existing account #278

Closed mikedonleyuoy closed 3 years ago

mikedonleyuoy commented 3 years ago

When attempting to update the password on an existing account using the VMHostaccount resource, the password is not updated.

This seems to be caused by this line:

return !$this.ShouldUpdateVMHostAccount($vmHostAccount) -or !$this.ShouldCreateAcountPermission($vmHostAccount)

in class VMHostAccount : BaseDSC - Test, in VMware.vSphereDSC.psm1

Based on the logic and comments in ShouldUpdateVMHostAccount, the set password action should run if the test ShouldUpdateVMHostAccount returns $true (which is negated to $false) in the above line (this means the password is not in the desired state). However, the ShouldCreateAccountPermission test will always fail (negated to $true) if the password test says the password isn't in the desired state. This means the password is never updated for an existing account.

SimeonGerginov commented 3 years ago

The bug was fixed with PR #279, so the change account password use case should work correctly.