SharePoint In Action

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

Archive for the tag “SharePoint PowerShell”

Exporting all SharePoint Group Members Into A File

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.UserLogin | Out-File $txtFile -Append

Nader Heshmat


Post Navigation