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

 

Engineer's Toolset v10Guy Recommends: SolarWinds Engineer’s Toolset v10

This Engineer’s Toolset v10 provides a comprehensive console of 50 utilities for troubleshooting computer problems.  Guy says it helps me monitor what’s occurring on the network, and each tool teaches me more about how the underlying system operates.

There are so many good gadgets; it’s like having free rein of a sweetshop.  Thankfully the utilities are displayed logically: monitoring, network discovery, diagnostic, and Cisco tools.  Try the SolarWinds Engineer’s Toolset now!

Download your fully functional trial copy of the Engineer’s Toolset v10

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 2010

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

 

See More Windows Update Error Codes 8004 Series

Error 800A101A8 Object Required   •Error 800A0046   •Error 800A10AD   •Error 800A000D

Error 80048820   •Error 800A0401   •Review of SolarWinds Permissions Monitor

Error 80040E14   • Error 800A03EA   • Error 800A0408   • Error 800A03EE

Solarwinds Free WMI MonitorGuy Recommends: WMI Monitor and It’s Free!

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, SolarWinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor


Do you need additional help?

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:

 

If you like this page then please share it with your friends