Enable SharePoint commandlets in PowerShell ISE by default

Post date: Jul 07, 2014 6:52:4 PM

To enable SharePoint commandlets to be available by default in PowerShell ISE when opening Powershell, do the following:

  1. Open the PowerShell ISE and create a new profile by running the following code:

        1. if (!(test-path $profile.AllUsersAllHosts))

        2. {

        3. new-item -type file -path $profile.AllUsersAllHosts-force

        4. }

  2. Open the newly created profile with the following command:

      1. psEdit $profile.AllUsersAllHosts

  1. The profile will be open in the PowerShell ISE (If the profile for some reason doesn't open then you can retrieve it at C:\Windows\System32\WindowsPowerShell\v1.0\profile.ps1). Add the following code to the profile:

        1. if ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )

        2. {

        3. Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell

        4. }

  1. Save the profile.

The next time you open the PowerShell ISE you will have all the Microsoft.SharePoint.PowerShell commandlets.