Is user member of group - Powershell

mikeydk
mikeydk used Ask the Experts™
on
Hey

Powershell to test if a user is member of a specific Group.

(not QUEST)

Thanks

Mike
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Rich WeisslerProfessional Troublemaker^h^h^h^h^hshooter

Commented:
Have you already looked at this powershell in the Technet Script Center?
Senior Systems Engineer
Commented:
example
$user = "user1"

if ((Get-ADUser $User -Properties memberof).memberof -like "CN=Domain Admins*")
{
$true
}
Else
{
$false
}

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial