If you are using Powershell with your SharePoint Environment, you might find developing complex Powershell scripts as annoying as I do.
But with Powershell ISE, developing scripts is much easier. And there is a way to load the SharePoint snapin by default, so you don’t need to load it yourself.
Following steps are necessary to achieve this:
1. Execute the following code in Powershell ISE to edit your profile settings :
if (!(test-path $profile.AllUsersAllHosts))
{new-item -type file -path $profile.AllUsersAllHosts –force }
powershell_ise $profile.AllUsersAllHosts
2. Add the following script:
$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” }
3. Restart Powershell ISE