Friday, October 2, 2015

Remove property from Property Bag with PowerShell

How to remove properties from multiple places in SharePoint with powershell script?

For Web Application

$web = Get-SPWeb <url>
$web.Properties.Remove('test') // this is a key
$web.Update()
$web.Properties

For Farm

$web = Get-SPFarm
$web.Properties.Remove('test') // this is a key
$web.Update()
$web.Properties



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



1 comment:

  1. Instead of $web.Properties.Remove('test'), use allproperties then it will work.

    so the correct way will be:

    $web = Get-SPWeb
    $web.AllProperties.Remove('test') // this is a key
    $web.Update()
    $web.Properties

    ReplyDelete