The following script will generate the text file which will give the list of Primary & Secondary Site collection Administrators for each web application.
Script:
Add-pssnapin microsoft.sharepoint.powershell -EA 0
$outputFile = "C:\\SCAdminsReport.txt"
Write-Host "This script will loop through all site collections in a web application and list the collection's URL, Primary Owner, and Secondary Owner"
$webapp = "http://sharepointsite/"
$Web = Get-SPWebApplication $webapp
$text = ""
$text | out-file $outputFile
foreach ($sites in $Web.sites) {
$text = "-------------------------------------------"
$text | out-file $outputFile -append
$text = "Site: " + $sites.url
$text | out-file $outputFile -append
$text = "Primary Owner: " + $sites.owner
$text | out-file "$outputfile" -append
$text = "Secondary Owner: " + $sites.secondarycontact
$text | out-file "$outputfile" -append
$text = "-------------------------------------------"
$text | out-file "$outputfile" -append
}
Write-Host "-----END------"
Script:
Add-pssnapin microsoft.sharepoint.powershell -EA 0
$outputFile = "C:\\SCAdminsReport.txt"
Write-Host "This script will loop through all site collections in a web application and list the collection's URL, Primary Owner, and Secondary Owner"
$webapp = "http://sharepointsite/"
$Web = Get-SPWebApplication $webapp
$text = ""
$text | out-file $outputFile
foreach ($sites in $Web.sites) {
$text = "-------------------------------------------"
$text | out-file $outputFile -append
$text = "Site: " + $sites.url
$text | out-file $outputFile -append
$text = "Primary Owner: " + $sites.owner
$text | out-file "$outputfile" -append
$text = "Secondary Owner: " + $sites.secondarycontact
$text | out-file "$outputfile" -append
$text = "-------------------------------------------"
$text | out-file "$outputfile" -append
}
Write-Host "-----END------"
No comments:
Post a Comment