Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Check if specific user is member of specific group

$
0
0

Hello everyone,

I'm trying to find out if a specific users is member of a specific group in the Active Directory. Google shows me a lot of examples for loginscripts, Quest's tool and local groups. I don't need local groups but domain groups that are located in the Active Directory and that Quest tool needs installment which i can't do unfortunately. 

I don't really have much to start with although I know how to add a specific user to a specific group. I need this to know if he already is member of that group or not.

I'm hoping for a simple solution.

This is what I have now:

$Group = [ADSI]"LDAP://localhost:389/CN=ICT,OU=ICT,DC=oxl,DC=local"
$Group.IsMember("LDAP://localhost:389/CN=Nathan,OU=ICT,DC=oxl,DC=local")
But it keeps saying FALSE



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>