Is it possible to check whether a password will be valid without creating an user on Windows?
I need to check if the password for an user that will be created later on in an installation process will be valid. That is, whether it will conform to the OS validation rules. Is there an API call to check if a given password will be valid? This is on Win开发者_Python百科dows
You're looking for NetValidatePasswordPolicy
function.
This can check against the local OS password policy too.
Windows 7 Help says that in password any characters can be used:
a..z
A..Z
0..9
` ~ ! @ # $ % ^ & * ( ) _ - + = { } [ ] \ | : ; " ' < > , . ? /
and space.
Read here: http://windows.microsoft.com/en-GB/windows7/Tips-for-creating-strong-passwords-and-passphrases
Maybe it is possible to use regular expression to check the password.
精彩评论