Verifying that the user name and password is typically scanned internally periodically to prevent the use of weak passwords.
Of course, the scan should be careful not to exceed the maximum number of errors, so as not to cause locking
The method of password authentication covers two types, one is domain user, one is local user
Authentication Methods for Domain Users:
$Try = New-object System.DirectoryServices.DirectoryEntry ("ldap://dc=contoso,dc=com", "$UserName", "$Password")
When the $try.name is empty, that is, the password is wrong, when the $try.name is not empty, that is, the password authentication is successful, the weak password account
Authentication methods for Local Users:
Add-type-assemblynamesystem. Directoryservices.accountmanagement
$DS = New-objectsystem.directoryservices.accountmanagement.principalcontext ([ System.directoryservices.accountmanagement.contexttype]::machine, "localhost")
$DS. Validatecredentials ("admin", "[email protected]")
The validation here directly returns TRUE or false, that is, whether the validation
PowerShell authentication user name and password