PowerShell / PSDscResources

MIT License
129 stars 53 forks source link

MSFT_UserResource: ValidateCredentials method fails if user account is locked #151

Open RandomNoun7 opened 5 years ago

RandomNoun7 commented 5 years ago

Details of the scenario you tried and the problem that is occurring

When a user of the resource tries to manage a user account that is disabled, the resource fails with an error - "This user can't sign in because this account is currently disabled."

Verbose logs showing the problem

Suggested solution to the issue

Please implement error handling in the ValidateCredentials method that can account for errors calling LogonUser which do not indicate invalid credentials.

The relevant errors to account for are: ERROR_ACCOUNT_RESTRICTION, ERROR_INVALID_LOGON_HOURS, ERROR_INVALID_WORKSTATION, ERROR_ACCOUNT_DISABLED

As documented on the Windows Dev Center Docs.