Getting started with Script Browser 1.3.2

 

What is Script Browser 1.3.2

Script Browser for Windows PowerShell ISE enables you to search for script samples in the TechNet Script Center. You can find script samples by using different filters, like programming languages, contributors and categories. After finding the script samples you need, you can mark the script samples as your favorite script samples. Then, you can download the script samples for later use.

 

Prerequisites

Important Note:

Windows Management Framework 3.0 or later version must be installed as a prerequisite on computers running Windows 7 or Windows Server 2008 R2. This is because Script Browser is an add-on for Windows PowerShell ISE, and the add-on feature of Windows PowerShell ISE is firstly introduced in Windows Management Framework 3.0.

You must add Windows Search service feature on computers running Windows Server 2008 R2, Windows Server 2012 and Windows Server 2012 R2 before using Script Browser. This is because Script Browser uses Windows Search Service to search downloaded script samples.

 

How to download, install and launch Script Browser

You can download Script Browser from the Download Center, and follow the installation instructions to install the Script Browser.  After the installation, you can launch Windows PowerShell ISE (powershell_ise.exe), and you should see the Script Browser and Script Analyzer extensions.  If you hit any errors in the process, please check our FAQ below or contact onescript@microsoft.com. 

 

Basic User Interface Introduction

Figure 1 Main view of Script Browser

 

Figure 2 Detail view of a script sample

Using Script Browser

 

Searching and Browsing

How to search for script samples

To search for script samples, please take the following steps.

  1. Type your keywords in the search box in the TechNet tab or Downloads tab, like domain user.
  2. Press Enter or click the Search button to start a search.
  3. When the search is completed, the first 10 script samples will be shown in the search result pane.
  4. If you want to narrow down the search results, for example, you can click Filter, change the category option from All Categories to Exchange, and then click Filter again. Script Browser will start a new search automatically and less results would be returned.

How to explore search results

To explore search results, please take the following steps.

  1. Start a search. We assume that this search returns 100 script samples.
  2. When the search is completed, the first 10 script samples will be shown in the search result pane.
  3. If you want to browse the next 10 script samples, please scroll to the end of search results. Script Browser will begin to search the next 10 script samples.
  4. When the search is completed, the next 10 search results will be loaded to the search result pane.
  5. If you want to check the latest script samples that are published to the TechNet Script Center, you can change the Sort By dropdown list from Relevance to Release Date. Script Browser will start a new search automatically and the latest script samples would be shown.

How to learn the details of a script sample

To learn the details of a script sample, please take the following steps.

  1. Start a search.
  2. When the search is completed, double-click one script sample, Script Browser will display a detail page. You can also click the Open button at the bottom of the search result pane.
  3. In the detail page, you can learn the title, summary, script preview of a script sample.
  4. If you want to know additional information about this script sample, click See More.
  5. If you want to add the script sample to your favorites, click Add to favorites.
  6. If you want to download the script sample, click the Downloads tab. Inside the Downloads tab, click Download next to the script sample package to download that package. Click Download All to download all sample packages.
  7. If you want to read the documentation of the script sample, click the Description tab.
  8. If you want to return to search the result pane, click the Back button at the top-left corner or the Close button at the bottom of the detail page.

Favorites and Downloads

How to add or remove favorite script samples

To add or remove favorite script samples, please take the following steps.

  1. Start a search.
  2. When the search is completed, select one or more script samples, and then right-click.
  3. When the context menu appears, click Add to favorites or Remove from favorites to add or remove favorite script samples. You can also click the Add to favorites or Remove from favorites button at the bottom of the search result pane.

How to download script samples

To download script samples, please take the following steps.

  1. Start a search.
  2. When the search is completed, select one or more script samples, and then right-click.
  3. When the context menu appears, click Download to download script samples. You can also click the Download button at the bottom of the search result pane.

How to search among downloaded script samples

To search among script samples, please take the following steps.

  1. Click the Downloads tab at the top of Script Browser.
  2. Type your keywords in the search box, like domain user.
  3. Press Enter or click the Search button to start a search.
  4. When the search is completed, the first 10 downloaded script samples that match the search criteria will be shown in the search result pane.

How to delete a downloaded script sample

To delete a downloaded script sample, please take the following steps.

  1. Click the Downloads tab at the top of the Script Browser.
  2. Select one downloaded script sample, and then right-click.
  3. When the context menu appears, click Delete to delete a downloaded scrip sample. You can also click the Delete button at the bottom of the Downloads tab.

Settings

How to change language settings

To change language settings of Script Browser, please take the following steps.

  1. Click the Settings button at the top-right corner of Script Browser.
  2. When the Settings window appears, click language dropdown list, choose a language that you want to use.
  3. Click OK.

How to change the sample download location

To change the sample download location, please take the following steps.

  1. Click the Settings button at the top-right corner of Script Browser.
  2. When the Settings window appears, click the Select Folder button.
  3. When the Browse for Folder dialog appears, choose a folder, like C:\TechNetScriptSamples, and then click OK to close this dialog.
  4. Click OK to close settings window.

Note
Script Browser uses Windows Search Service to search downloaded script samples. If you change the sample download location, Script Browser will help you to add the new location to the crawl scope of Windows Search Service. Then Windows Search Service will begin to re-index. You may not search the downloaded samples for a while before the re-index progress is completed.

How to use web proxy in Script Browser

To use web proxy in Script Browser, please take the following steps.

  1. Click the Settings button at the top-right corner of the Script Browser.
  2. When the Settings window appears, choose one of the proxy setting.
  3. Click OK to close the settings window.

FAQ

How to search script samples that are written in other script languages?

Although Script Browser is an add-on for Windows PowerShell ISE, you can easily change the programming language in the filter. Thus, you can search script samples that are written in other script languages. After you double-click the downloaded script sample, the related script editor would be open.

How to temporarily disable Script Browser

To temporarily disable Script Browser, please take the following steps.

  1. Start Windows PowerShell ISE.
  2. Run this command in the console, powershell_ise $profile.
  3. When the profile is opened in the script pane, comment out the lines between #Script Browser Begin and #Script Browser End
  4. Click the Save button in the toolbar then close this script file. Script Browser will not be loaded when you start Windows PowerShell ISE next time.
PowerShell
Edit|Remove
#Script Browser Begin 
#Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\System.Windows.Interactivity.dll' 
#Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\ScriptBrowser.dll' 
#Add-Type -Path 'C:\Program Files (x86)\Microsoft\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 

How to solve the error indicating that the profile cannot be loaded because running scripts is disabled on this system?

After installing the Script Browser, you may get the following error message when starting Windows PowerShell ISE.

File <path>\Microsoft.PowerShellISE_profile.ps1 cannot be loaded because running scripts is disabled on this system. For more information, seeabout_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.
At line:0 char:0
PS C:\Windows\System32\WindowsPowerShell\v1.0> 

In order to make sure that Script Browser can be loaded automatically each time Windows PowerShell ISE starts, your Windows PowerShell ISE profile is modified or being created during the installation. However, a Windows PowerShell ISE profile is a script that runs when Windows PowerShell ISE starts. You can start Windows PowerShell with the "Run as administrator" option and running this command to change the execution policy, Set-ExecutionPolicy -ExecutionPolicy RemoteSigned. Script Browser should be loaded after Windows PowerShell ISE is restarted.

How to solve the warning message that indicates the profile is signed during the installation?

During the installation, you may see this warning message: “The setup identifies that your Windows PowerShell ISE profile has been signed. It will continue to install/uninstall the assembly files of Script Browser. You are required to modify the Windows PowerShell ISE profile manually. Please refer to the documentation for more details.”

For security reasons or other purposes, you may have signed your Windows PowerShell ISE profile to prevent the file from being changed by an unauthorized user or process. But after doing so, Script Browser cannot be loaded automatically when Windows PowerShell ISE starts.

To allow automatic loading of Script Browser when Windows PowerShell ISE starts, please take the following steps.

  1. Start Windows PowerShell ISE.
  2. Run this command in the console, powershell_ise $profile.
  3. When the profile is opened in the script pane, copy your existing Windows PowerShell code to a new file, then append the following code to the end of the file.
  4. Click the Save button in the toolbar and replace the existing Windows PowerShell ISE profile.
  5. Sign the new Windows PowerShell ISE profile by using the approved procedure of your company. Script Browser will be loaded when you start Windows PowerShell ISE next time.
PowerShell
Edit|Remove
#Script Browser Begin 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\System.Windows.Interactivity.dll' 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\ScriptBrowser.dll' 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\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
Note You need to change the path C:\Program Files (x86)\Microsoft\Script Browser\ to the right path if you are not using the default folder.

How to solve the warning message that indicates the profile is signed during the uninstallation?

During the uninstallation, you may see this warning message: “The setup identifies that your Windows PowerShell ISE profile has been signed. It will continue to install/uninstall the assembly files of Script Browser. You are required to modify the Windows PowerShell ISE profile manually. Please refer to the documentation for more details.”

For security reasons or other purposes, you have signed your Windows PowerShell ISE profile to prevent the file from being changed by an unauthorized user or process. But after doing so, Script Browser cannot be uninstalled completely.

To allow automatic loading of Script Browser when Windows PowerShell ISE starts, please take the following steps.

  1. Start Windows PowerShell ISE.
  2. Run this command in the console, powershell_ise $profile.
  3. When the profile is opened in the script pane, copy your existing Windows PowerShell code to a new file, then delete the following code from the file.
  4. Click the Save button in the toolbar and replace the existing Windows PowerShell ISE profile.
  5. Sign the new Windows PowerShell ISE profile by using the approved procedure of your company. After doing so, Script Browser is completely removed from your computer.
PowerShell
Edit|Remove
#Script Browser Begin 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\System.Windows.Interactivity.dll' 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\Microsoft Script Browser\ScriptBrowser.dll' 
Add-Type -Path 'C:\Program Files (x86)\Microsoft\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  

How to solve the network connection error?

Script Browser requires an Internet connection to search for script samples in the TechNet Script Center. To solve the network connection error, you may try the following steps.

  1. Run the following command in Windows PowerShell ISE console.
    (Test-NetConnection -ComputerName gallery.technet.microsoft.com -CommonTCPPort HTTP).TcpTestSucceeded
  2. If the result is true, it indicates you have an Internet connection to the TechNet. If the result is false, please go to Step 4.
  3. If you are using a proxy server, please contact your helpdesk or network administrator to make sure the proxy server is working properly.
  4. Start Windows Network Diagnostics, then follow the wizard to identify and fix the problems. You can refer to Wired and wireless network problems for more instructions.

 

Known Issue

Existing downloaded script samples will not move to the new folder after the sample download location is changed.

In this version of Script Browser, the existing downloaded script samples will not move to the new folder after the sample download location is changed. The only workaround is to change the sample download location at the first time when using Script Browser.

Feedback

If you have any feedbacks about Script Browser, you can write to onescript@microsoft.com.