Computer Performance, Logon Scripts

Code  800A03FD - Expected 'Case' 

Troubleshooting Code 800A03FD - Expected 'Case' 

Introduction to Code 800A03FD

Error code, 800A03FD occurs when you execute a VBScript 'Select' statement.  The problem is you are using Select but without the corresponding 'Case' statement.  There are two variations of this error:Error Code 800A03FD - Expected 'Case'

Example 1 WMI
Example 2 Pure Select Case

For both Examples, the Symptoms you get

The script does not execute as you had hoped.  Instead. Windows Scripting host generates a message box like this picture:

For both Examples the Cause of Code 800A03FD

Your VBScript contain is missing a argument.  Source: Microsoft VBScript compilation error, indicates an syntax error in a statement in your script.  Compilation errors such as missing brackets are easy, but problems with Select ... Case are more subtle.  For more help let us check is the Line: number, (12 in example 1).

The Solutions

The Windows Scripting Host gives us three useful clues, firstly, look on Line: 10, do count any remark or empty lines.  Secondly, the Char: number 8, is very useful in tracing the error.  Thirdly, there is something wrong with the Select statement, which is confirmed in the message by Error: Expected 'Case'. 

The underlying problem is that Select * is inappropriate here.  In VBScript 'Select' requires Case.  'Select * from... WHERE' is an SQL construction that is misused in this example.  If you employ Select, then is should be in brackets:
(Select * from colaccounts).  There should be no 'Where' clause.

Example 1 of Script showing Error 800A03FD

Check the  Select *    The problem is that you cannot say
where objAccount.name = "Guest".

Try Removing the where statement alltogether.

 

'VBScript to Enumerate Accounts, and SID
On Error Resume Next
if Err <> 0 Then
set lasterr = CreateObject("WbemScripting.SWbemLastError")
Wscript.echo lasterr.Operation
End if
set objWMIService = GetObject("Winmgmts:\\" & strComputer)
set colAccounts = objWMIService.InstancesOf("win32_Account")
For each objAccount In colAccounts
    Select * from colaccounts where objAccount.name = "Guest"
   WScript.echo "Name " & objAccount.name & vbCRLf & _
   "SID : " & objAccount.SID & vbcrlf & _
   "Sid Type : " & objAccount.SIDType & vbcrlf & _
   "Status : " & objAccount.Status & vbcrlf & _
   "Domain : " & objAccount.Domain & vbcrlf & _
   "Caption : " & objAccount.Caption
Next
WScript.quit

 

 

Example 2 Pure Select Case Error 800A03FD

The problem is here on Line 16: Select objDisk.DriveType

The solution is: Select Case objDisk.DriveType

 

' SelectCaseDrive.vbs
' Version 1.2
' Guy Thomas 15th August 2004

Option Explicit

Dim objWMIService, colDisks, objDisk ' Objects
Dim strDriveType, strComputer ' Strings

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk")
For Each objDisk in colDisks
Select objDisk.DriveType
Case 1 strDriveType = "Drive could not be determined."
Case 2 strDriveType = "Removable Drive (Floppy?)"
Case 3 strDriveType = "Local hard disk."
Case 4 strDriveType = "Network disk."
Case 5 strDriveType = "Compact disk (CD)"
Case 6 strDriveType = "RAM disk."
Case Else strDriveType = "Drive type Problem."
End Select
Wscript.Echo "Device ID = " & objDisk.DeviceID &vbCr _
& "Drive Type : " & strDriveType
Next
 

 

 

Solarwinds IpMonitorTry a different solution, download SolarWinds ipMonitor

Here is my thinking, ipMonitor will give you valuable data about your network and servers.  This extra information just may unlock the solution to your error code.  One more thing, sometimes when troubleshooting you go around in circles; therefore if you try a different, but related approach, you may just crack the problem.  Free Download of SolarWinds ipMonitor

Computer Training Software - Recommended Training VideosGuy Thomas recommends Computer Training Software

Their topics and material are ideal for getting you started with VBScript.  The videos are easy to follow and you can control the pace.  Try their free demo material and then see if you want to buy the full package. See more about VB Script Training CD.


Do you need extra help?

For interpreting the WSH messages check Diagnose 800 errors.

For general advice try my 7 Troubleshooting techniques

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:

 

 *


Google

Webcomputerperformance.co.uk

GFi Events Manager

Guy Recommends: GFi EventsManager

Here is a solution to monitor, manage and archive thousands of events that are generated by devices across your entire network.  Get your free evaluation copy of GFI EventsManager.

 

Home Copyright © 1999-2008 Computer Performance LTD All rights reserved

Please report a broken link, or an error.