Friday, 27 January 2017

Powershell basic commands for sharePoint

How to Find the list of web applications in a SharePoint farm Using PowerShell commands?

Get-spwebapplication

How to find the list of weapplications  in a content database

Get-spwebapplication -contentdatabase "wss_content_111"

How to find the list of site collection in a farm and how to export to csvfile?

Get-spsite|out-file c:\spsite.csv

How to find the list contentdatabases attached to the webapplication?

get-spcontentdatabase -webapplication "http://servername:111"

How to move site collections from one contentdatabse to other contentdatabse?

get-spsite -contentdatabase "wss_content_11"|move-spsite -destinationdatabase "wss_content_A"

How to move single sitecollection from one contentdata bse to other contentdatabase?

move-spsite "http://servername:111/sites/software" -destinationdatabse "wss_content_A"

How to create site collection in a particular content database?

New-spsite -name "hardwae" -description "harware portal server" -url "http://servername:111/sites/hardware" -template "sts#0" -owneralias "system/administrator"-contentdatabse "wss_content_A"