Dallas Smetter
asked on
Using userAccountControl to set *both* PASSWD_CANT_CHANGE and DONT_EXPIRE_PASSWORD
I know how to use one or the other, but how can I achieve both?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I need to do this for nearly a quarter million users, so I can't do it manually.
I'll try pony10us's suggestion and post back.
Thanks!
I'll try pony10us's suggestion and post back.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
And we can also, in this situation, use the userAccountControl setting to ensure that student passwords never expire while applying a GPO so that it can't be changed ;-)
Just for reference using what I provided you have many other settings available but I only gave you the ones you requested. Here are the most common settings:
const int UF_ACCOUNTDISABLE = 0x0002;
const int UF_PASSWD_NOTREQD = 0x0020;
const int UF_PASSWD_CANT_CHANGE = 0x0040;
const int UF_NORMAL_ACCOUNT = 0x0200;
const int UF_DONT_EXPIRE_PASSWD = 0x10000;
const int UF_SMARTCARD_REQUIRED = 0x40000;
const int UF_PASSWORD_EXPIRED = 0x800000;
all you have to do is add the ones you want to this line:
int userControlFlags = UF_PASSWD_NOTREQD + UF_DONT_EXPIRE_PASSWD;
const int UF_ACCOUNTDISABLE = 0x0002;
const int UF_PASSWD_NOTREQD = 0x0020;
const int UF_PASSWD_CANT_CHANGE = 0x0040;
const int UF_NORMAL_ACCOUNT = 0x0200;
const int UF_DONT_EXPIRE_PASSWD = 0x10000;
const int UF_SMARTCARD_REQUIRED = 0x40000;
const int UF_PASSWORD_EXPIRED = 0x800000;
all you have to do is add the ones you want to this line:
int userControlFlags = UF_PASSWD_NOTREQD + UF_DONT_EXPIRE_PASSWD;
Then selecting the User cannot change password and Password never expires settings.