SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this PowerShell script

function SetPropertyBag ($webAppUrl, $key, $value) {

    $spwebApp=Get-SPWebApplication -Identity $webAppUrl
    Write $spwebApp  

    if($spwebApp.Properties.ContainsKey($key) -eq $False)
    {$spwebApp.Properties[$key]=$value; }

    Write-Host -foregroundcolor Green "value set in "  $key  " = "  $spwebApp.Properties[$key]    


$webAppUrl= Read-Host 'Enter the web application url';
$siteCollectionUrl= Read-Host 'Enter the site collection url';
SetPropertyBag $webAppUrl "VGSP.VIS.TicketTale.EngineJob" $siteCollectionUrl ;

It's working great on PowerShell but when i try to get the property bag value by server side code I don't find.

I also deployed the property bag settings solution and didn't find the values that I've set there either.

share|improve this question
up vote 1 down vote accepted
share|improve this answer
Method invocation failed because [System.Collections.Hashtable] doesn't contain a method named 'Update'. At C:\Users\Alshimaa\Desktop\PropertyBagSetter.ps1:19 char:32 + $spwebApp.Properties.Update <<<< (); + CategoryInfo : InvalidOperation: (Update:String) [], RuntimeException + FullyQualifiedErrorId : MethodNotFound – mshmshcs Sep 9 '12 at 13:15
It is actually recomanded to use AllProperties instead as Properties is only maintained for back-compatibility purposes and is obsolete! – Marius Constantinescu - MVP Sep 9 '12 at 16:10
Thanks @c-marius, updated the answer to use AllProperties – eirikb Sep 9 '12 at 19:07

Just had the same problem. Solution:


The solution suggested by eirikb does not work because:

  1. The SPWebApplication object does not have a property called "AllProperties".
  2. It does have a property called "Properties" (as written by the OP), however this property does not have an Update() method.

(Note: I'm using SP2010)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.