2010 Scripting Games: Beginner Event 10–Troubleshooting a Script


2010 Scripting Games badge  Bookmark and Share

Note: We are no longer accepting entries for this event. See the due dates page for a list of all event due dates.

About This Event




Date of Event

May 7, 2010

Due Date

May 14, 2010


Event Scenario

Your boss has given you a script written by a colleague that does not work. The script is supposed to display a dialog box that lists the current logged-on user as shown in the image below.

Unfortunately, the script does not work, and it does not generate any errors. The VBScript version of the script, and the Windows PowerShell version of the script are shown here.


On Error Resume Next

Set wmi = GetObject(“winmgmts:”)

colitems = wmi.Execquery(“Select user from Win32_computersystem”)

For Each item In colitem

 WScript.Echo item.username



$errorActionPreference = “silentlycontinue”

$wmi = Get-WmiObject -Class Win32_computerSystem -Property name

$wshShell = New-Object -ComObject wscript.shell



When your script runs properly, the following dialog box should be displayed.

Image of dialog box script should display


2010 Scripting Games Links


Ed Wilson and Craig Liebendorfer, Scripting Guys