How to export users from SharePoint group with PowerShell?
Get-SPWeb https://projekt/orgit/ |
Select -ExpandProperty SiteGroups |
Where {$_.Name -EQ "Orgit-Visitors"} |
Select -ExpandProperty Users |
Select Name |
Out-File C:\NewFolder\Members.txt
#No free space after the name-for easier import
$content = Get-Content Members.txt
$content | Foreach {$_.TrimEnd()} | Set-Content Members.txt
Note: Before command locate folder where you wont to export file (txt, csv...) (cd c:\NewFolder)
Get-SPWeb https://projekt/orgit/ |
Select -ExpandProperty SiteGroups |
Where {$_.Name -EQ "Orgit-Visitors"} |
Select -ExpandProperty Users |
Select Name |
Out-File C:\NewFolder\Members.txt
#No free space after the name-for easier import
$content = Get-Content Members.txt
$content | Foreach {$_.TrimEnd()} | Set-Content Members.txt
Note: Before command locate folder where you wont to export file (txt, csv...) (cd c:\NewFolder)
No comments:
Post a Comment