ISE Addons, PowerShell, Scripting, SharePoint2010
comments 2

On-demand import of SharePoint 2010 cmdlets within PowerShell ISE

I did not plan to write this post but a few blog posts around using SharePoint 2010 cmdlets within PowerShell ISE made me put my thoughts in to this. Last month, I published a post around using module-sets in PowerShell ISE. The idea was simple. We add a menu item to ISE addons menu and then on select of that menu item, we load a bunch of related modules for a specific task. The same thing can be done in case of SharePoint 2010 cmdlets too. This post suggests that you load SharePonit 2010 cmdlets using PowerShell profile. I would certainly do this with other “light-weight” modules but not with SharePoint 2010 snap-in. This, essentially, because this snap-in usually takes a long time (more than 7-8 secs) to load. This can be frustrating at times. I prefer loading this snap-in only when I need to those cmdlets.

The method I mentioned to add addon menu item in an earlier post requires either PSISECream or ISEMenu modules. So, for those who don’t prefer using these modules, in this post I will show you how to add an ISE addon menu item to load SharePoint cmdlets without using PSISECream or ISEMenu modules. The following code snippet shows how to do that. We use the ISE scripting object model directly instead of relying on Add-ISEMenu.

The above command — when you run inside ISE — will add the SharePoint cmdlets option to the ISE addon menu. So, now, you can load the cmdlets by either selecting the menu item or by using Alt+S key combination. Now, we can just add this line to our PowerShell profile and make sure it loads only when using ISE. To do that,

This is it. Hope this is helpful.

Filed under: ISE Addons, PowerShell, Scripting, SharePoint2010

by

Ravikanth is a principal engineer and the lead architect for Microsoft and VMware virtualized and hybrid cloud solutions within the Infrastructure Solutions Group at Dell EMC. He is a multi-year recipient of Microsoft Most Valuable Professional (MVP) award in Windows PowerShell (CDM) and Microsoft Azure. Ravikanth is the author of Windows PowerShell Desired State Configuration Revealed (Apress) and leads Bangalore PowerShell and Bangalore IT Pro user groups. He can be seen speaking regularly at local user group events and conferences in India and abroad.