Friday, June 29, 2012

How to use PowerGUI for SharePoint PowerShell scripts

If you are looking for a better PowerShell IDE than the PowerShell window or PowerShell ISE, you should check out PowerGUI:  http://en.community.dell.com/techcenter/powergui/m/bits/20439049.aspx

If you are using PowerGUI for SharePoint 2013, you are in luck! The latest version of PowerGUI supports SharePoint 2013. 

If you want to script for SharePoint 2010, unfortunately, the latest version of the IDE runs on the .Net 4.0 runtime and therefore and does not support SharePoint PowerShell commands.

However, there is a fix for this!

  1. Navigate to the PowerGUI installation directory (C:\Program Files (x86)\PowerGUI)
  2. Look for the file called ScriptEditor.exe.config
  3. Open up the file in a text editor of your choice
  4. Find the supportedRuntime element for .Net 4.0
  5. Comment out that line and save the file
  6. Now, re-open PowerGUI Script Editor
  7. From the File menu, select PowerShell Libraries
  8. Select the checkbox next to Microsoft.SharePoint.PowerShell
  9. Wait for the PowerShell libraries to load
  10. Once they are loaded, you should be able to begin creating PowerShell scripts for SharePoint!

3 comments: