Get / Set Site Properties Using Powershell For Sharepoint Site

Powershell is a very powerful tool which can be used to automate almost everything by writing scripts. It’s already making the life easier for people who does the deployment. Recently, I came across a need where I wanted to set and get the site properties for a sharepoint site and wrote the following code for the same.

Get the site property

$SPWeb = Get-SPWeb "http://server/sites/SiteName"
write-host $SPWeb.AllProperties["Property1"]
write-host $SPWeb.AllProperties["Property2"]

 Set the site property

$SPWeb = Get-SPWeb "http://server/sites/SiteName"
$SPWeb.AllProperties["Property1"] = "Value1"
$SPWeb.AllProperties["Property2"] = "Value2"
$SPWeb.Update()

Hope this helps you if you are looking for this.

Get / Set Site Properties Using Powershell For Sharepoint Site

Leave a Reply

Scroll to top
%d bloggers like this: