Frage

I try to enable windows account with this code but i ve exception in ObjectSecurity (Null reference) in this line ActiveDirectorySecurity userSecurity = user.ObjectSecurity;

War es hilfreich?

Lösung

I would suspect that your error would be on the 5th line in the code

user.Properties["userAccountControl"].Value = val & ~0x2; //this will error

and if you were to debug it you would probably see the following error

Error Pointers and fixed size buffers may only be used in an unsafe context

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top