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:
Open the PowerShell ISE and create a new profile by running the following code:
if (!(test-path $profile.AllUsersAllHosts))
{
new-item -type file -path $profile.AllUsersAllHosts-force
}
Open the newly created profile with the following command:
psEdit $profile.AllUsersAllHosts
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:
if ((Get-PSSnapIn -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapIn -Name Microsoft.SharePoint.PowerShell
}
Save the profile.
The next time you open the PowerShell ISE you will have all the Microsoft.SharePoint.PowerShell commandlets.