Archive for Scripts
Help! Farm Admin cannot execute cmdlets in SP 2010 Management Shell
In order to execute farm level cmdlets in SharePoint Management Shell you will need to be given Shell Admin access. Even if you are a farm administrator and you have not been given Shell Admin Access, then you won’t be able to execute farm administrative operation using PowerShell. There are lots of operations that you cannot do via the Central Administration GUI and for which you will require Shell Admin Access.
List who has SP Shell Admin Access
Before you get started with addition, it would be good to check who has Shell Admin access using the following PowerShell cmdlet
PowerShell To List Site Template
SharePoint 2010 Management Shell makes it easier to get a list of Site Templates installed in the farm and also creating sites using the names is straight forward.
To get a list of all globally installed site templates use the following PowerShell cmdlet
get-spwebtemplate
To get the basic information about all the STS template, use the following PowerShell cmdlet
get-spwebtemplate “STS*”
To get the basic information about all the SPS template, use the following PowerShell cmdlet
get-spwebtemplate “SPS*”
PowerShell To List Service Applications
Service Applications is one of the newest additions in SharePoint 2010 arsenal of features. As again you can manage Service Applications via the SharePoint 2010 Management Shell. In the illustration under, you will see how we can get a list of Service Applications deployed.
Get-SPServiceApplication cmdlet lists all service applications in a farm with their Display Name, TypeName and ID
Now type the same command piped with Select Id, Name to get these results
PowerShell To List Feature Definitions
Get-spfeature gets the SharePoint features based on a given scope.
This cmdlet behaves differently at each scope, getting the enabled Features at each level. There are 4 levels of scope
· Farm
· WebApplication
· Site (Site Collection)
· Web (Site)
get-spfeature -farm (gets all the enabled Feature in the farm)
get-spfeature -webapplication http://server (gets all enabled the Features in the Web application)
get-spfeature -site http://server/sites/IT (gets all the enabled Features on the site collection)
get-spfeature -site -sandboxed (gets all installed the Feature definitions on the site)


