I have a few custom settings for my feature that I am creating. I want a way to populate these values on install with some default values. However if needed an admin should be able to change the defaults via powershell. Is this possible? The settings would be at the web applciation level but could saved somewhere else if that would help.

Wictor has Six ways to store settings in SharePoint would any of these meet my needs?


Actually you can reach almost any SharePoint object from the PowerShell.

For example, SPWebApplication.Properties can be modified using the following PowerShell code:

$web = Get-SPWeb http://localhost
$webApplication = $w.Site.WebApplication
$webApplication.Properties["xxx"] = "yyy"


enter image description here

To set the default values, you can use C# code in Feature Receiver.

Please, note, that for activating WebApplication-scoped feature, as well as for accessing the SPWebApplication.Properties collection, you should have farm administrator permissions.


I think what would work for you is the property bag. Since its accessible via .NET you can write powershell scripts to interact with them accordingly.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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