Powershell to get Property bag for Farm, Web App or Site Collection

Application developers, now a days store many of the configurable properties in the Property bags. As an administrator you might frequently be asked the value of these properties.

I  used below scripts to check Properties at Farm, Web Application and Site Collection level.

#Add PS SnapIn for SharePoint

# Get all the Properties from Farm Property bag
$myFarm = Get-SPFarm;

foreach ($prop in $myFarm.Properties.GetEnumerator() | Sort-Object -Property Name) {
                     Write-Host " - " $prop.Name "->" $prop.Value
}

# Get all the Properties from Web Application Property bag
$myWebApp = Get-SPWebApplication "http://webapp"

foreach ($prop in $myWebApp.Properties.GetEnumerator() | Sort-Object -Property Name) {
                     Write-Host " - " $prop.Name "->" $prop.Value
}

# Get all the Properties from Site Collection Property bag
$myWeb = Get-SPWeb "http://sitecollection"

foreach ($prop in $myWeb.Properties.GetEnumerator() | Sort-Object -Property Name) {
                     Write-Host " - " $prop.Name "->" $prop.Value
}


6 comments:

  1. thank you for sharing. Can you share more information like remove Property value from bag / change value

    ReplyDelete
  2. Great Post!
    Thanks a lot for sharing!
    I found this blog to be very useful!!
    PowerShell Scripting Training in Bangalore

    ReplyDelete
  3. Okay ! I've been looking for some script like this one for hours ! Great Script, thanks a lot for sharing !

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete