Shuky Capon
Shuky Capon

Reputation: 785

finding out if user used for DirectoryEntry connection is an administrator

I have an existing DirectoryEntry connection and I want to check if the user that was used for the creation of this DirectoryEntry belongs to a specific group. anyone knows how to achieve this?

Thanks, Shuky

Upvotes: 1

Views: 323

Answers (1)

marc_s
marc_s

Reputation: 755023

I don't think there's any magic, easy way to do this....

On the DirectoryEntry object, you do have a UserName property which should hold the name of the user that was used to create this entry, if a specific user was supplied. Using that user name, you could do a directory lookup and find that user and check whether that user belongs to the Administrators group (or any other group) - but it's not exactly a one-liner.

Upvotes: 2

Related Questions