Loading SharePoint Snapin on all PowerShell Consoles and PowerShell ISE by Default


While working on SharePoint Servers we have to run PowerShell script a lot of times and most of the time we use SharePoint Management Shell. The biggest reason to use it, is off course the Loading of SharePoint Snapin by default. It is also a fact that SharePoint management shell is limited for many reasons. Very small editing window, quick editing is not enabled, Copy Paste is difficult and there is no Intellisence or help available while we type the cmdlets and select parameters. It also does not allow us to save the script so we have to write from scratch most of the time. Although we can modify the PowerShell console settings on per user basis but it will require lot of work from everyone.

To solve this problem we can add SharePoint Snapin to load on all servers in the Farm by default. This can be done right after Farm build process and will improve efficiency of SharePoint support team.


1. Generate PowerShell Profile file using script.

2. Copy SharePoint Snapin load script into the file.

3. Test PowerShell ISE and PowerShell Console.

Configuring PowerShell to Load SharePoint Snapin

1. Click Start à All Programs à Accessories à Windows PowerShell à PowerShell ISE

2. Open PowerShell ISE and type the following script to generate a Profile for all users.

If (!(Test-Path $profile.AllUsersAllHosts))


New-Item –Type File –Path $profile.AllUsersAllHosts –Force


Powershell_ise $profile.AllUsersAllHosts

3. Press F5.


4. This will open profile.ps1 file in PowerShell ISE.

5. Type the following.

$ver = $host | select version

if ($ver.Version.Major -gt 1) {$host.Runspace.ThreadOptions = “ReuseThread”}

if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell” –ErrorAction

SilentlyContinue) -eq $null) {

Add-PSSnapin “Microsoft.SharePoint.PowerShell”


6. Save and Close PowerShell ISE

Testing PowerShell ISE and Windows PowerShell

1. Click Start à All Programs à Accessories à Windows PowerShell à PowerShell ISE

2. Type Get-SP


3. Click on Windows PowerShell ICON next to Start Button to open PowerShell Console.

4. Type Get-SP and press Tab key to see Auto completion of SharePoint cmdlets. Press tab few times to browse other cmdlets.

5. Type Get-SPSite and press enter to see if SharePoint Site collection are listed. (If you have rights)


This process has to be done on all SharePoint servers in the Farm after we build the SharePoint Farm and add servers. The profile.ps1 must not be created using Notepad or windows explorer as rights for that file are not copied correctly.

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 )

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