I have a need to find out what users on a Windows 2000 network have the box "User cannot change password" checked.
I know how to iterate through the users and detect the simple things such as username, dial in permissions, etc, but I am not having any luck detecting whether the &H0040 flag is set in userAccountControl is set.
A simple test case is below for our network:
dim test,testand
const UF_PASSWD_CANT_CHANGE = &H0040
set oUserObj = GetObject("LDAP://CN=A User,OU=Users,DC=TEST,DC=COM"
test = oUserObj.userAccountControl
testand = test and UF_PASSWD_CANT_CHANGE
MsgBox "UserAccountControl:" & Chr(9) & test
MsgBox "and:" & Chr(9) & testand
set oUserObj = Nothing
wscript.exit
Theoretically if the flag is set the testand should be a 1 and if it is not set it should be a 0. However, this is not working the value is always a 0. Any ideas on what I am doing wrong?
Thank you for your time.
Roger
I know how to iterate through the users and detect the simple things such as username, dial in permissions, etc, but I am not having any luck detecting whether the &H0040 flag is set in userAccountControl is set.
A simple test case is below for our network:
dim test,testand
const UF_PASSWD_CANT_CHANGE = &H0040
set oUserObj = GetObject("LDAP://CN=A User,OU=Users,DC=TEST,DC=COM"
test = oUserObj.userAccountControl
testand = test and UF_PASSWD_CANT_CHANGE
MsgBox "UserAccountControl:" & Chr(9) & test
MsgBox "and:" & Chr(9) & testand
set oUserObj = Nothing
wscript.exit
Theoretically if the flag is set the testand should be a 1 and if it is not set it should be a 0. However, this is not working the value is always a 0. Any ideas on what I am doing wrong?
Thank you for your time.
Roger