Link to home
Start Free TrialLog in
Avatar of jawhitmoyer
jawhitmoyer

asked on

Problem Enabling Account

I just finished rewiriting an app in C# (was in VB.NET), but it doesn't work the same. When I ran the VB code below, I would end up with an account that was enabled. However, when I run the C# code below, I still get the user, but it is disabled.

Please advise.

VB.NET:
Dim userACFlags As Object = newUser.Properties("userAccountControl").Value
newUser.Properties("userAccountControl").Value = userACFlags Or &H200 Or &H10000 Xor &H2

C#:
int userACFlags = (int) newUser.Properties["userAccountControl"].Value; //returns 546
newUser.Properties["userAccountControl"].Value = userACFlags | 0x200 | 0x10000 ^ 0x2;
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jawhitmoyer
jawhitmoyer

ASKER

Thanks Henry. As always you know your stuff!