Quick script to show all email distribution groups that a particular user is a member of:
#
# Cobbled together by Gnawgnu
# 5/17/08
#get the identity of the user by alias
$Username = (get-user gnawgnu).Identity
#search all groups for that user
$groups = get-group -Filter {Members -eq $username}
#display all groups that have an email address
#defined that's longer than 0 characters
$groups | Where-Object {$_.WindowsEmailAddress.Length -ne 0}
Saturday, May 17, 2008
Subscribe to:
Post Comments (Atom)
2 comments:
Thanks man !
This is just what I've been looking for.
I'm now a regular visitor to your blog for any useful Powershell script.
Cheers,
Albert
Another alternative:
get-group | where-object {$_.Members -eq (get-user alias).Identity}
Post a Comment