Image of 2010 Scripting Games   Bookmark and Share


The 2010 Scripting Games are designed to test a wide variety of real-world skills and scenarios. A wide range of scripting skills will be useful. However, specific skills are targeted for this year’s games. The following resources will assist you in successful completion of the 2010 Scripting Games.

Registry

Manipulation of the registry is one of the most common administrative tools and skills. The successful participant would know how to test for registry key existence as well as how to create new registry keys.

Windows PowerShell resources include the Hey, Scripting Guy! Blog. There are a couple of scripts in the Script Center Script Repository that might be useful.

VBScript resources also include the Hey, Scripting Guy! Blog. Additional examples are can be found in the Script Center Script Repository.

The WMI Registry class, StdRegProv, provides remoting capability for VBScript registry reads and writes. It also works in Windows PowerShell when you do not have access to Windows PowerShell 2.0 remoting. The thing that is confusing about the WMI StdRegProv class is the large number of methods that exist. In fact, there’s a different method for each type of registry entry. There are Hey, Scripting Guy! posts that talk about using VBScript and WMI to read the registry. The Scripting Guide has a good registry overview as do the Sesame Script articles in the Scripting Library.

Event log

Reading the event logs is a standard network administrator task. By checking the event logs on a daily basis, problems can often be spotted before they develop into more serious issues. The successful participant will know how to read the various traditional event logs from both local and remote perspectives.

Windows PowerShell resources related to event logs include the Hey, Scripting Guy! Blog. There are several scripts of interest in the Script Center Script Repository.

VBScript resources related to event logs include the Hey, Scripting Guy! Blog. There are some pretty cool scripts in the Script Center Script Repository that bear investigation.

Working with text files and folders

A common question I get on the Script Center is about how I work with text files. For all the good things that Microsoft Word documents offer, text files are still heavily used in an IT scripting environment. They are used for input to scripts, they are used for logging from scripts, and they are often used to collect and display data gathered from the running of scripts. It is therefore important that a scripter know how to read, write, and create plain text files.

Windows PowerShell resources for working with text files can be found on the Hey, Scripting Guy! Blog. In addition, there are several scripts in the Scripting Guys Script Repository that are interesting and offer useful insights.

VBScript resources for working with text files include those on the Hey, Scripting Guy! Blog as well as those in the Scripting Guys Script Repository. In addition, the Sesame Script articles in the Scripting Library about folders and about files are excellent.

Working with environmental variables

IT pros often need to be able to work with environmental variables on a computer system, either to update them or to read the values contained in them.

VBScript resources include the Scripting Guide in the TechNet Library.

Windows PowerShell users may want to review the help section about working with the environmental provider. They may also want to review the MSDN documentation for the System.Environment .NET Framework class.

In addition, both VBScript users and Windows PowerShell users may want to examine the MSDN documentation for the Win32_Environment WMI class.

Using WMI information

Windows Management Instrumentation (WMI) is core Windows technology that permits retrieving information about computer hardware and software from either a local or a remote computer.

Windows PowerShell users may want to review some Hey, Scripting Guy! posts, and examine some of the scripts in the Scripting Guys Script Repository.

VBScript users also have a number of good resources at their disposal, including Hey, Scripting Guy! posts and scripts in the Scripting Guys Script Repository.

Looping

The ability to loop through collections is a standard technique. A For Each loop or a For Next loop is always useful in VBScript, as is the Do Loop. The same constructions exist in Windows PowerShell as well. The Windows PowerShell Foreach statement and the Do While statement are similarly useful. In fact, you should check out the Windows PowerShell Getting Started series on the Hey, Scripting Guy! Blog, because it has lots of useful tips for people just learning Windows PowerShell.

Special folders

Microsoft Windows has many special folders. There are also many different ways of accessing those special folders. You can use the .NET Framework System.Environment class specialfolder enumeration in Windows PowerShell. The methods used by Windows PowerShell are some of the same ones used by VBScript. The WshShell object has the ability to report on special folders, as well as the shell.application object. Shell.application can, of course, also be used in VBScript as well.

Working with arrays

In the Windows PowerShell world, arrays are .NET Framework objects: System.Array and the like are documented on MSDN. The Windows PowerShell help topic on arrays also has good information for using and working with arrays. Because Windows PowerShell arrays are objects, they have a number of methods that make working with arrays both powerful and relatively easy. In the VBScript world, a number of very good articles have been produced on the Hey, Scripting Guy! Blog that talk about working with arrays.

Functions and subroutines

In the VBScript world, there were both functions and subroutines. In the Windows PowerShell world, there are only functions. For VBScript, check out the Sesame Script articles on functions and subroutines to get a better handle on how to construct these. For Windows PowerShell, check out the Getting Started series; there are at least eight Hey, Scripting Guy! Blog posts that specifically talk about working with functions. Some Windows PowerShell help articles address functions and advanced functions.

Error handling

In VBScript the error-handling capabilities were somewhat rudimentary. However, there was a good Sesame Script article about error handling for VBScript that is worth a read. From the Windows PowerShell perspective, there are more capabilities. A series of Hey, Scripting Guy! Blog posts provides a good overview of the subject, as do the help articles for Try/Catch/Finally and Throw. The $ErrorActionPreference variable is talked about in the help article on preference variables.

Graphical scripting

Quite a few Hey, Scripting Guy! Blog posts talk about creating and using HTAs with VBScript. There are also several Hey, Scripting Guy! posts that talk about using various graphical elements with Windows PowerShell.