Profile in Sharepoint 2010 Powershell

Hi Guys,

As we all Know Powershell is Powerfull and i am playing with Powershell for Quite sometime.Now everytime i start Powershell ISE  First i need to run following command in order to get access of all commands for Sharepoint 2010 and also i need to run all User Define Powershell functions.

 Add-PSSnapin "Microsoft.Sharepoint.Powershell" 

Wouldn’t be nice if we get all functions and above command run once we Start Powershell ISE ? Here is basic steps for that

Type $Profile on Command Line and u will get some path in my case  i have “C:\Users\LoginUser\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1”.

Now Create File called Microsoft.PowerShellISE_profile.ps1 at above address and add command

 Add-PSSnapin "Microsoft.Sharepoint.Powershell" 

Now add code for all user Define functions that you want to use everytime and save file.Restart ISE and Type some Sharepoint Powershell command

Get-SPWebApplication 

or User define function name  and u will get result.

That’s it…

Note if you are using Sharepoint 2010 Powershell host you don’t need to add Add-PSSnapin “Microsoft.Sharepoint.Powershell” and Also ISE is installed with Server but u need to activate it in order to Use.

Credit for this goes to book called Professional Sharepoint 2010 Administration……..

Thanks

Ronak

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s