Sep 13 2017

Export SharePoint Users and Groups to Excel using PowerShell #powershell #development #environment


Export SharePoint Users and Groups to Excel using PowerShell

Export SharePoint Users and Groups to Excel for analyzing SharePoint Groups and Users along with their Account Name, E-mails!We can export SharePoint User Group to excel using PowerShell. Here is how:

PowerShell Script to Export Users Groups:

This script will Export SharePoint user group to excel. Here is the report output:

PowerShell script to Get All Groups and Members of Each group:

How to Get members of a particular group in SharePoint 2007 using PowerShell:
Its also possible to read user properties from User Profile.

PowerShell script to Get Members of Each Group at Web (Sub-Site) Level:
and the output: SharePoint PowerShell export group members

You might also like:

SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.

Document SharePoint Farm
Automatically generate SharePoint documentation.

Here the script for getting the list only fr site owner on the web application

#Using Get-SPSite in MOSS 2007
function global:Get-SPSite($url)
return new-Object Microsoft.SharePoint.SPSite($url)

function global:Get-SPWeb($url)
$site= New-Object Microsoft.SharePoint.SPSite($url)
if($site -ne $null)
return $web

#Write the Header to Tab Separated Text File
Site Name`t URL `t Group Name `t User Account `t User Name `t E-Mail | out-file d:\UsersandGroupsRpt.txt

$SPWebApp = Get-SPWebApplication https://sharepoint

foreach ($site in $SPWebApp.Sites)

$sites = Get-SPSite $site.url

#Iterate through all Webs
foreach ($web in $sites.AllWebs)
#Write the Header to Tab Separated Text File
$($web.title) `t $($web.URL) `t `t `t `t | out-file d:\UsersandGroupsRpt.txt -append
#Get all Groups and Iterate through
$Group = $Web.sitegroups | Where-Object <$_.Name -Like *Owners* >
foreach ($group in $Web.groups)

if(($Group.Name.ToLower() -Like *owners* ))

`t `t $($Group.Name) `t `t `t | out-file d:\UsersandGroupsRpt.txt -append
#Iterate through Each User in the group
foreach ($user in $group.users)
#Exclude Built-in User Accounts

`t `t `t $($user.LoginName) `t $($ `t $($user.Email) | out-file d:\UsersandGroupsRpt.txt -append

write-host Report Generated at d:\UsersandGroupsRpt.txt

Written by admin

Leave a Reply

Your email address will not be published. Required fields are marked *