Weekend Scripter: Introducing Script Browser and Script Analyzer
Summary: Scott Ge and Bill Grauer share new Windows PowerShell resources: Script Browser and Script Analyzer.
Microsoft Scripting Guy, Ed Wilson, is here. Today we have a guest blog from Scott Ge and Bill Grauer from Microsoft Customer Service and Support. Take it away Scott and Bill…
To write quality script to automate IT, we often want to reference some reliable script samples or invite experts to review the script and provide suggestions. Looking for reliable script samples requires numerous copying and pasting, and switching between webpages and the scripting environment. Additionally, a script review heavily depends on the availability of script experts. You’ve probably had the same question many other scripters have when they carry on the process, “Is there a simpler way of doing this?”
Yes, there is. Welcome Script Browser and Script Analyzer to automate the process. (You can download these features from the Microsoft Download Center: Script Browser & Script Analyzer 1.1.)
- Script Browser You can search, download and manage 9000+ TechNet script samples covering all Microsoft IT products from within the scripting environment. Script Browser even supports offline search so users can download interesting scripts and search them when they do not have Internet access.
- Script Analyzer This Windows PowerShell script expert is available to you 24×7. When you scan your Windows PowerShell script with Script Analyzer, it provides suggestions to improve your script quality and readability.
Script Browser for the Windows PowerShell ISE is an app developed by Microsoft Customer Service and Support with assistance from the Windows PowerShell product group. It’s designed to save IT pros from the hideous process of searching and reusing scripts. We started with the 9 000+ script samples in the TechNet Script Center. Users can directly search, learn about, and download TechNet scripts from within Windows PowerShell ISE (the scripting environment).
Although it is named Script Browser, it offers more than browsing. You can search, download, and learn about script samples, and search offline.
Search, download, and learn about script samples
With the Script Browser, nearly 10,000 scripts on TechNet are available at your fingertips. You can filter scripts by scripting languages (for example, Windows PowerShell, VBScript, T-SQL), by author, and by category:
You can download and reuse the script sample, and read the script documentation from within the Script Browser:
Download scripts and search offline
Sometimes scripters have to write scripts in environments without the Internet access. They cannot search for script samples on the Internet. Script Browser comes to the rescue. Script Browser allows you to download all interesting script samples with one click when you have the Internet access:
When you go offline, you can switch to the Downloads tab and enjoy the exact same search experience among all the script samples you downloaded:
The Script Analyzer is like a Windows PowerShell script quality expert that is available to you 24×7. It scans your current Windows PowerShell script against Windows PowerShell best practice rules, and it provides suggestions to improve the script's quality and readability.
By double-clicking the results, the relevant script will be highlighted in the script editor:
You can configure the Script Analyzer rules in the Settings window of Script Analyzer:
The current release includes five Windows PowerShell best practice rules. Many of them were introduced in the Hey, Scripting Guy! Blog:
- Invoke-Expression use should be carefully considered.
- Cmdlet alias use should be avoided.
- Empty catch blocks should be avoided.
- Positional arguments should be avoided.
- Advanced function names should follow the standard verb-noun naming convention.
Each rule comes with a detailed description, good and bad examples, and supporting documents. You can also suggest a new rule or vote for others’ suggestions at this CodePlex site: Microsoft Script Analyzer. The team that creates the rules monitors the forum closely. Based on your suggestions and votes, they will provide the corresponding Script Analyzer rules in future updates. They are also looking into the capability for users to write their own Script Analyzer rules, and then plug-in to the Script Analyzer.
We are committed to continuously adding new features, new script search sources, and new Script Analyzer rules to benefit the work of IT pros. We have an ambitious roadmap. If you love what you see in Script Browser and Script Analyzer, please recommend it to your friends and colleagues. If you encounter any problems or have any suggestions, please contact firstname.lastname@example.org. Your precious opinions and comments are more than welcome.
- A World of Scripts at your Fingertips – Introducing Script Browser
- Getting started with Script Browser 1.1
This article includes FAQs about installing and using the Script Browser.
- Here Comes the Update of Script Browser & Script Analyzer 1.1
This article includes a detailed description of each Script Analyzer rule with good and bad examples and supporting documents.
~Scott and Bill
Thank you, Scott and Bill. These are awesome features, and I have already found them to be valuable in daily use.
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace.
Ed Wilson, Microsoft Scripting Guy