Export SharePoint property bag of all SiteCollections

0

PowerShell Script to export SharePoint property bag information from all SiteCollection of an specified WebApplication.

Add-PSSnapin Microsoft.SharePoint.PowerShell

$url = "https://sharepoint"

[Microsoft.SharePoint.Administration.SPWebApplication]$SPWebApplication = $null
[Microsoft.SharePoint.SPSite]$SPSite = $null
$sharerooms = @()

$SPWebApplication = Get-SPWebApplication $url

ForEach ( $SPSite in $SPWebApplication.Sites ) {

    Write-Host $SPSite.RootWeb.Url -ForegroundColor Cyan
    #$SPSite.RootWeb.AllProperties

    $shareroom = New-Object PSObject

    Add-Member -InputObject $shareroom -MemberType NoteProperty -Name "Url" -Value $SPSite.RootWeb.Url

    ForEach ( $item in $SPSite.RootWeb.AllProperties.GetEnumerator() ) {
    
        Add-Member -InputObject $shareroom -MemberType NoteProperty -Name $item.Name -Value $item.Value

    }
    $sharerooms += $shareroom
}

$csv = "c:\propertybag.csv"

$sharerooms | Export-Csv -Path $csv -Delimiter ";" -NoTypeInformation
Share.

About Author

Christian Unnerstall

Christian Unnerstall, founder of devshooin.com, enjoys designing and building things that look nice and work well, whether it's websites or services within the interwebs. Have questions - feel free to reach out to him. Enjoy

Leave a Reply