Shell access to SharePoint.

One of the things that has always annoyed me in SharePoint 2010 is the security in PowerShell when trying to work with SharePoint objects.

There I am, logged into my freshly created development box, drop into PowerShell and can’t access anything, despite running as administrator. The missing ingredients, yes Database permissions, so duly into SQL, give my log on account DBO access (Come on, it’s a development box! grin..)

A better way though is to use the PowerShell cmdlet Add-SPShellAdmin against each of the content databases that I want to work with. (It’s my Dev box, so all of them frankly..)

http://technet.microsoft.com/en-us/library/ff607596.aspx 

This command, coupled with a quick PowerShell script to loop through the SPContentDatabase collection soon ensures unrestricted access!

Get-SPContentDatabase | ForEach-Object {
Add-SPShellAdmin -username "domain\paul" -database $_
}

I wish I’d come across this cmdlet much earlier while working with SP2010 but I never really did get straight into PowerShell until the last 10 months or so.

Paul.

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.