Вопрос

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

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top