Getting Started: SharePoint and Powershell

Very first question: What's the difference between SharePoint Management PowerShell and Windows PowerShell ISE

SharePoint Management PowerShell:
1. Wrapper on top of Windows PowerShell with preloaded SharePoint objects
2. Comes with boring black command prompt
3. Comes with "SharePoint Snapin"

Windows PowerShell ISE (Integrated Scripting Environment)
1. Simple default PowerShell with no SharePoint objects
2. comes with developer friendly and performs object based command line functions
3. We can add "SharePoint Snapin"

Note: Windows PowerShell and Windows PowerShell ISE are different. Later is the better IDE and before one is typical black command prompt

Script to add "SharePoint Snapin"

if((Get-PSSnapin "Microsoft.SharePoint.PowerShell") -eq $null)
{
      Add-PSSnapin Microsoft.SharePoint.PowerShell
}


Post this, you can simply test it with simple commands:
$web = Get-SPWeb "<<Siteurl>>"
$web.ID

Result:
Guid
<<32 digit unique id separated by "-">>

Note: This need to be performed in SharePoint server (Meaning SharePoint should have been already installed in the machine)

To perform PowerShell operation from remote machine/server, please see the below link for instruction:

http://sharepoint-community.net/profiles/blogs/powershell-remoting-for-sharepoint

https://blogs.msdn.microsoft.com/opal/2010/03/07/sharepoint-2010-with-windows-powershell-remoting-step-by-step/



 

Comments

Popular posts from this blog

Run Powershell script on Remote Computer/Server

Power BI Refresh Issue: unable to convert the value '' from the source data type 'VT_BSTR' to the expected data type 'VT_I8.

SPDActivities - DP.SharePoint.Workflow - Workflow failed to run