I created a new script containing the line below and clicked Debug.
At C:\Users\MyUser\Documents\slk.ps1:2 char:19
+ $spweb = Get-SpWeb <<<< http://myweb
Hmm, I guess I either need to 1) allow the SharePoint Cmdlets to run under .NET 4, 2) find an older version of PowerGUI, or 3) run PowerGUI under .NET 3.5. I chose option 3.
After some digging, I found the already-existant ScriptEditor.exe.config file inC:\Program Files (x86)\PowerGUI.
I opened it up with NotePad++ and noticed the following line:
<supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″ />
And promptly commented it out and saved the file.
<!– <supportedRuntime version=”v4.0″ sku=”.NETFramework,Version=v4.0″ /> –>
Next, I started up PowerGUI and was able to run the same SharePoint cmdlet.