How to use integrated scripting environment in SharePoint 2010

You know you can use SharePoint 2010 management shell for writing cmdlets for SharePoint, but you can also use the ISE(Integrated Scripting Environment) which is a host in Windows Server 2008 used to write cmdlets for PowerShell.

First, You need to activate this host by clicking on server manager, then features>> Add Features >> Windows PowerShell Integrated Scripting Environment(ISE) and click to install.

Once you have the ISE on your server. Open it. If you try to type PowerShell cmdlets for SharePoint it won’t work, you need to direct the ISE to run PowerShell commands for SharePoint.

Type the following:

Add-PSSnapIn Microsoft.SharePoint.PowerShell

Now you can write cmdlets for SharePoint.  But note if you close the ISE and open it again, this connection with SharePoint will be removed.  So you need to call this command once the ISE opens each time, so how do you automate this?

Well, ISE has a profile inside windows server 2008. So you need to find this profile and enter the command inside it so each time the ISE opens it looks to the profile and looks up the command the command to connect to SharePoint.

Type $profile inside the ISE you will get a path to your profile, Ended with .ps1  like this :

C:UsersMyUserDocumentsWindowsPowerShellMicrosoft.PowerShellISE_profile.ps1

Try to type notepad $profile, this will open the profile, in case you found this error message in notepad…

you need to create a path to your profile as provided from the path given by the ISE. then create a text