SharePoint/PowerShell – Get the AD groups associated with a site collection and output to CSV file

Need to deliver or better understand the AD groups associated with your SharePoint site collection? Try this: [sourcecode] $SPWebApp = Get-SPWebApplication http://sitecollectionURLhere/ foreach ($SPSite in $SPWebApp.Sites) { write-host -foregroundcolor green "Working on Site Collection: " + $SPsite.RootWeb.Title $SiteURL = $SPsite.RootWeb.URL $ADgroup=Get-SPUser -Web $SiteURL -Limit ALL | Where { $_.IsDomainGroup }…

Need to deliver or better understand the AD groups associated with your SharePoint site collection? Try this:

[sourcecode]
$SPWebApp = Get-SPWebApplication http://sitecollectionURLhere/

foreach ($SPSite in $SPWebApp.Sites)
{
write-host -foregroundcolor green "Working on Site Collection: " + $SPsite.RootWeb.Title
$SiteURL = $SPsite.RootWeb.URL
$ADgroup=Get-SPUser -Web $SiteURL -Limit ALL | Where { $_.IsDomainGroup }
}
echo $ADgroup | Export-Csv "C:\Temp\FileNameGoesHere.csv"
[/sourcecode]

PS1 download is here: https://1drv.ms/u/s!Ag4C3w6EUQIggowvfXrE0Z3tfWKJeA

Discover more from @JaredMeredith

Subscribe now to keep reading and get access to the full archive.

Continue reading