Tip: How to break apart Script Browser & Script Analyzer

Script Browser and Script Analyzer are bundled together in one setup.   After the installation, when you launch Windows PowerShell ISE, both Script Browser and Script Analyzer are loaded.  

image

 

In this blog article, you will learn the trick to solely load Script Browser or Script Analyzer.

First, you need to open your ‘My Documents’, and find the ‘WindowsPowerShell’ folder.   In the folder, you should see a file called ‘Microsoft.PowerShellISE_profile.ps1’. 

image

 

Please open the file, and find the following section. 

#Script Browser Begin
Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\System.Windows.Interactivity.dll'
Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\ScriptBrowser.dll'
Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\BestPractices.dll'
$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

 

If you only want to load Script Browser, please comment or remove the following two lines:

Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\BestPractices.dll'
$scriptAnalyzer = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Script Analyzer', [BestPractices.Views.BestPracticesView], $true)

 

If you solely want to load Script Analyzer, please comment or remove these three lines, and restart Windows PowerShell.

Add-Type -Path 'C:\Program Files (x86)\Microsoft Corporation\Microsoft Script Browser\ScriptBrowser.dll'
$scriptBrowser = $psISE.CurrentPowerShellTab.VerticalAddOnTools.Add('Script Browser', [ScriptExplorer.Views.MainView], $true)
$psISE.CurrentPowerShellTab.VisibleVerticalAddOnTools.SelectedAddOnTool = $scriptBrowser