$GroupName=
"<Group Name>"
;
$Output
=
@(
"GroupName|Name|Login|Email|Department|Title"
);
$web
=
Get
-
SPWeb $SiteUrl;
$site
=
$web.Site;
$rootWeb
=
$site.RootWeb;
$UserInfoList
=
$rootWeb.Lists[
"User Information List"
];
$web.SiteGroups[$GroupName].Users|
%
{
$user
=
$UserInfoList.GetItemById($_.ID);
if
($user
-
ne $null){
$JobTitle
=
$user[
"JobTitle"
];
$Dept
=
$user[
"Department"
];
}
$Output
+
=
($GroupName
+
"|"
+
$_.Name
+
"|"
+
$_.UserLogin
+
"|"
+
$_.Email
+
"|"
+
$Dept
+
"|"
+
$JobTitle);
}
$rootWeb.Dispose();
$web.Dispose();
$site.Dispose();
$Output >
"GroupMembers.csv"