Archive for SharePoint

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

clip_image001

To get the basic information about all the STS template, use the following PowerShell cmdlet

get-spwebtemplate “STS*”

clip_image002

To get the basic information about all the SPS template, use the following PowerShell cmdlet

get-spwebtemplate “SPS*”

clip_image003

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

clip_image002

Now type the same command piped with Select Id, Name to get these results

clip_image004

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)

PowerShell To Delete Site Collection

It’s easy to create a site collection using PowerShell as seen in an earlier post. Now let’s see how easy it is to delete a site collection using PowerShell cmdlet. It’s any day efficient way to create and delete site collections using PowerShell then use Central Administration GUI.

For the purpose of testing we will

· Create a site collection named 2Delete using a site template STS#0

· Delete a site collection named 2Delete

  1. New site collection created using SharePoint 2010 Management Shell.
    clip_image002
  2. Site collection created. as per confirmation. Delete site collection using SharePoint 2010 Management Shell.
    clip_image004

PowerShell To Add Secondary Site Collection Admin

Situation: You want to add secondary site collection administrator

Old Method: Go to Central Admin… or use stsadm

Smart Method: Use PowerShell

How?

Launch your Administrator: SharePoint 2010 Management Shell

Type

Set-SPSite –Identity http://server –SecondaryOwnerAlias justsharepoint\alpesh

 

image

This will add secondary site collection administrator. Soon will show you how you can add secondary site collection administrator for all site collections in a managed path!