Blog Archive

SharePoint-courses
José David Roldán Baena

Differences between SharePoint 2010 Management and Shell Windows PowerShell

2011-12-27 12:45:00 by José David Roldán Baena

In this article is going to be explained the differences between the Windows PowerShell console and the SharePoint Management Shell in SharePoint manage.

SharePoint 2010 Management Shell loads a Windows PowerShell profile located in the SharePoint root. The profile’s path is: SharePointRoot \CONFIG\ POWERSHELL\ Registration\ SharePoint.ps1.

This script configures the initial user environment for Windows PowerShell. The three things that the profile does are the followings:

Load the SharePoint snap-ins. Without the SharePoint snap-ins is impossible to interact with SharePoint.

In PowerShell you cannot perform any SharePoint task because that snap-ins is not loaded.

 

PowerShell Error Sharepoint task

 

To load the SharePoint snap-ins, you must run the following command:

Add-PSSnapin Microsoft.SharePoint.PowerShell

 

Add SharePoint PSSnapin To PowerShell

 

Another way to add functionality to Windows PowerShell is to use a process called reflection. For example: [System.Reflection.Assembly]::Load(“Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”).

This was required in SharePoint 2007 but is not recommended in SharePoint 2010 where the SharePoint snap-in is available.

Set the PSThread option to Reuse Thread. This is a setting that improves the utilization of memory in Windows PowerShell and reduces the likelihood of memory leaks.

In Windows PowerShell, each command is started in its own execution thread. If you use Windows PowerShell you must run the following command:

$Host.Runspace.ThreadOptions = “ReuseThread”

 

ReuseThread PowerShell

 

This command set the ThreadOptions to “ReuseThread” making that each command run in the same thread.

Adds the Stsadm to the path

SharePoint Management Shell adds the path to the Stsadm.exe command to its path. Stasadm is located in SharePoint Root/ BIN folder. This allows you to use Stsadm to perform tasks, in addition to Windows PowerShell.

All the Stsadm operations are in the following link:

http://technet.microsoft.com/en-us/library/cc263384%28office.12%29.aspx

Regards

References:

http://msdn.microsoft.com/en-us/library/ee537913.aspx

10174A Configuring and Administering Microsoft SharePoint 2010

Comments

#re: differences between sharepoint 2010 management and shell windows powershell
Friday, April 6, 2012 - 07:57 PM by Don Jones
A very good demonstration that there *is* no such thing as a "SharePoint Management Shell." There's only Windows PowerShell, with some legwork done automatically for you. You can always do that same legwork yourself, if you want to build a custom shell configuration that does SharePoint and whatever else you may need.
Leave a Comment
(*) Title:
(*) Name:
Your URL:
(*) Comments:
Follow us on: