The Script Browser for Windows PowerShell ISE has been announced yesterday on the PowerShell Team blog and was actually released the day before on the download center

I wanted to give it a try before the announcement but I was too enthusiast and failed to meet the requirements.

To save your time, here are the requirements. You need:

Microsoft .NET Framework 4 (required by PowerShell 3.0) Windows Management Framework 3.0 Microsoft .NET Framework version 4.5 or a later version (required by ScriptBrowser.dll)

I missed the .Net 4.5 and got the following error:

Add-Type : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.





To get the above display, I modified the code of the Powershell ISE profile ( $profile = “$env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShellISE_profile.ps1”) like this:

#Script Browser Begin try { Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\System.Windows.Interactivity.dll' -ErrorAction Stop Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\ScriptBrowser.dll' -ErrorAction Stop Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\BestPractices.dll' -ErrorAction Stop $scriptBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Script Browser', [ScriptExplorer.Views.MainView], $true) $scriptAnalyzer = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Script Analyzer', [BestPractices.Views.BestPracticesView], $true) $psISE.CurrentPowerShellTab.VisibleVerticalAddOnTools.SelectedAddOnTool = $scriptBrowser #Script Browser End } catch { Write-Warning -Message "Failed because $($_.Exception.message)" }

To fix the error, I installed Microsoft .NET Framework 4.5.1 (Offline Installer) that

is a highly compatible, in-place update to the Microsoft .NET Framework 4 and the Microsoft .NET Framework 4.5.

Then I read a second time the page and complied with the ‘install instruction’

Start Windows PowerShell with the “Run as administrator” option. Run this command: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

but I run into a second issue:

As you can see on the following screenshot, there’s a message saying Network error, please check your internet connection and proxy settings in the newly loaded ‘script browser’ tab.



Worse, the Update-Help and Invoke-WebRequest don’t run anymore although a procmon trace shows that the HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ProxySettingsPerUser isn’t found and that my proxy settings are being read and used correctly from the Current User registry hive.

I used the following code snippet I posted on this blog post when investigating another proxy issue in order to determine what proxy settings the ISE was reading from the HKCU hive.

-join ( (Get-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections').DefaultConnectionSettings | Foreach { [char][int]"$_"} )

Then I removed the newly created Microsoft.PowerShellISE_profile.ps1 responsible for displaying the script browser tab and confirmed that Update-Help and Invoke-WebRequest work without any issue.

Then I loaded manually the script browser and again it had the same issue.

After that I clicked on the option symbol I’ve highlighted



…and as soon as I’ve set the ‘use Internet Explorer’ settings, everything worked 🙂

Bonus:

You can view the settings with:

[ScriptExplorer.Properties.Settings]::Default

That said. You must also be warned. Don’t try to set properties on ScriptExplorer.Properties.Settings default instance although it appears to be possible.

You may end up with inconsistent settings and the script explorer may not launch anymore.



If you mess with the settings of the ScriptExplorer.Properties.Settings default instance, you might need to delete the user.config while the ISE is running as it gets recreated when the ISE is closed.

Get-ChildItem "$env:userprofile\AppData\Local\Microsoft_Corporation\powershell_ise*" -Include user.config -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -Verbose

The settings of the script explorer are stored in the user.config file and can be also viewed like this:

$xml = ([xml](Get-Content (Get-ChildItem "$env:userprofile\AppData\Local\Microsoft_Corporation\powershell_ise*" -Include user.config -Recurse -Force -ErrorAction SilentlyContinue))) $xml.configuration.userSettings."ScriptExplorer.Properties.Settings".setting