Thursday, June 20, 2013

SharePoint Basic PowerShell Commands

Power Shell:

          Difference between windows powershell and sharepoint powershell: No much difference except that sharepoint powershell is preloaded with “Microsoft.SharePoint.powershell” snapin. If we add this snap in in windows powershell, we can execute sharepoint commands in windows powershell.
To add sharepoint snap in: add-pssnapin “Microsoft.sharepoint.powershell”
To remove the sharepoint snap in: remove-pssnapin “Microsoft.Sharepoint.powershell”
To get all commands in powershell: get-command -pssnapin “Microsoft.Sharepoint.powershell”
To list all web applications: get-spwebapplication
To list all site collection: get-spsite “<url>” ex: get-spsite http://veenar:21607/*   //spsite=>sitecollection
To list all sites in site collection: get-spweb –site http://veenar:21607/                                  //spweb=>sites in site collection
To list Titles of sites in web application: we can pipe the result from one powershell command to another like given below.
 Get-spsite http://veenar:21607/* | get-spweb | select title
To list users who have access to the web application: get-spuser –web “<url>”
To list all features: get-spfeature –limit all

To list all site features: get-spfeature -limit all | where-object {$_.scope -eq "site"}             //scope is site(features are one of the ways of deploying sharepoint solutions to sharepoint-scope can be site,farm,webappliaction)

No comments:

Post a Comment