SharePoint In Action

An attempt to share my day-to-day SharePoint experience

Exporting all SharePoint Group Members Into A File

Hi,
Here is the SharePoint PowerShell script to get all group members for a SharePoint 2010 site and export it to a file:


$mySite = Get-SPSite “your sharepoint site url here”
$txtFile = “c:\groupmembers.txt”
foreach($grp in $mySite.RootWeb.SiteGroups)
{
    "`r`n`r`nGroup Name:” + $grp.Name | Out-File $txtFile -Append
    foreach ($usr in $grp.Users)
    {
          $usr.name + "," + $usr.UserLogin | Out-File $txtFile -Append
    }
} 

Cheers,
Nader Heshmat

Advertisements

Single Post Navigation

One thought on “Exporting all SharePoint Group Members Into A File

  1. Thank you SO much! This is exactly what I needed 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: