Datasheet
UNDERSTAND THE COMPONENTS 11
Getting Started with
Windows PowerShell
Basics
PART 1
TIP
For more information on editing your user profi le script, type
help about_
profiles
from any Windows PowerShell window or view the TechNet article “How to
Create Profi les in Windows PowerShell ISE” at
http://technet.microsoft.com/
en-us/library/dd819492.aspx
.
Understand Required Permissions
Before you can use the SharePoint 2010 Management Shell (or speci cally, the
SharePoint 2010 cmdlets), you must have the appropriate permissions. You
must be a member of the
SharePoint_Shell_Access
role in the SQL Server
database applicable to the commands that are being run, and you must be a
member of the
WSS_Admin_WPG
local security group on each SharePoint server.
By default, the
SharePoint_Shell_Access
role exists only in the SharePoint
Con guration Database.
Using the Add-SPShellAdmin cmdlet, you can easily add users to these roles across
your Farm. Typically, the setup account (the account used to build the SharePoint
Farm) will have rights to run this cmdlet, but you can enable others to run the cmd-
let by ensuring that they are a local administrator on the server and have
dbcreator
and
securityadmin
rights on the database servers. If you are using your setup
account, there is nothing you need to do.
To grant a user rights to execute most SharePoint cmdlets that a ect the Farm,
run the following command, which will add the user to the
SharePoint_Shell_
Access
role in the Con guration Database and to the
WSS_Admin_WPG
local
security group on each server:
PS C:\> Add-SPShellAdmin -UserName “domain\user”
To grant a user rights to execute cmdlets that a ect a speci c database, add the
-Database
parameter to the call:
PS C:\> Add-SPShellAdmin -UserName “domain\user” i
-Database “DatabaseName”
In some cases, you may also be required to add the user to the local administra-
tors group manually on one or more servers. You may also be required to add the
user to the Farm Administrators group, which can be done using either the Central
Administration site or Windows PowerShell using the
New-SPUser
cmdlet, as
shown below:
PS C:\> New-SPUser -UserAlias “domain\user” -Web i
“http://sp2010:12345/” -Group “Farm Administrators”
c01.indd 11c01.indd 11 5/16/2011 11:12:31 AM5/16/2011 11:12:31 AM