My reading List

Every once in awhile I need to check the property bag on a SPWeb object. I have made a quick PowerShell script to view all the properties on the root web. You can check other webs in the site collection by adding the relative Url to the OpenWeb Method.

Here is the 4 lines of code.

Add-PSSnapin "Microsoft.SharePoint.Powershell" -ErrorAction SilentlyContinue
$site = spsite "http://server"
$web = $site.OpenWeb()
$web.AllProperties

As I am normally on my development machine I want to be able to run any PowerShell scripts as I need. By default I cannot do this because the Execution Policy for PowerShell is set to Restricted By Default.

There are 4 policies:

  1. Restricted
  2. AllSigned
  3. RemoteSigned
  4. Unrestricted

To see the current policy of your machine use the following command:
Get-ExecutionPolicy

To set the policy so you can run your all your scripts use the following command.
Set-ExecutionPolicy Unrestricted

By switching to this policy you make your system less secure. Probably not recommended for production machines.

See the Following URL for more information: http://technet.microsoft.com/en-us/library/ee176961.aspx