Created
February 7, 2015 06:45
-
-
Save BrendanThompson/a222c88e86c9db5c53c8 to your computer and use it in GitHub Desktop.
Retrieves all AD Groups used for permissions recursively within SharePoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") | |
$siteCollection = New-Object Microsoft.SharePoint.SPSite("http://companyweb") | |
foreach ($site in $siteCollection.AllWebs) | |
{ | |
foreach ($role in $($site.Roles)) | |
{ | |
foreach ($user in $role.Users) | |
{ | |
if ($($user.IsDomainGroup) -eq $True) | |
{ | |
Write-Output $user.LoginName | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment