Computer Performance, Logon Scripts

Code Error 800A03F6 - Expected 'End'

Troubleshooting Code 800A03F6 - Expected 'End'

Introduction to error Code 800A03F6

This error code, 800A03F6 occurs when you execute a VBScript.  The problem is that you have initiated 'If...Then.. End' logic, but you have omitted the End.

The Symptoms you get 800A03F6 Code 800A03F6 - Expected 'End'

The script does not execute as you hoped, instead you get a WSH error message.

The Cause of Error 800A03F6

The underlying cause error 800A03F6 of is a syntax omission, you are missing an 'EndIF' or and 'End' statement.  When you have nested If's or nested Else IF statements, then the chances of omitting one of the closing End statements increases dramatically.  Note that the Source: is telling us it's a compilation error, meaning faulty syntax.

The Solution

This a mixture of logic and syntax.  Check each 'If', or 'Else If' statement and ensure there is a corresponding End If command.  As ever, check the Line: number, in my example there are not enough 'End If' statements corresponding to the 'Else If' statements.

  ‡

Example of Error 800A03F6 Script

Here is the critical section of the script, which contains multiple 'Else If' statements.  In the problem script there is one too few 'End If' closing statements.  For clarity I have left a blank line where the missing statement should be.

Lower section of script starting at about line 40.

If OSystem = "XP" Then
   Wscript.Echo " This is where you set XP Group Policy "
   Else If OSystem = "Windows 2003" Then
   Wscript.Echo " No Group Policy on the server"
   Else If OSystem = "W2K" Then
   Wscript.Echo " You could set W2K Group Policy "
   Else Wscript.Echo " Default group policy "
   End If
   
End If

 

 

Corrected Version

If OSystem = "XP" Then
   Wscript.Echo " This is where you set XP Group Policy "
   Else If OSystem = "Windows 2003" Then
   Wscript.Echo " No Group Policy on the server"
   Else If OSystem = "W2K" Then
   Wscript.Echo " You could set W2K Group Policy "
   Else Wscript.Echo " Default group policy "
   End If
    End If
End If

 

Guy Recommends: SolarWinds Engineer's Toolset v10Engineer's Toolset v10

The Engineer's Toolset v10 provides a comprehensive console of utilities for troubleshooting computer problems.  Guy says it helps me monitor what's occurring on the network, and the tools teach me more about how the system itself operates.

There are so many good gadgets, it's like having free rein of a sweetshop. Thankfully the utilities are displayed logically: monitoring, discovery, diagnostic, and Cisco tools.  Download your copy of the Engineer's Toolset v 10

Full Script to show that the error is around line 50.

' OSVerBranch.vbs
' Purpose VBScript to discover the operating system version.
' Learning Points: Win32_ WMI objects. Case Select
' Usage if want to 'branch' depending on the OS
' Author Guy Thomas http://computerperformance.co.uk/
' Version 3.2 - November 14th 2004
' --------------------------------------------------------------'
Option Explicit
Dim objWMI, objItem, colItems
Dim strComputer, VerOS, VerBig, Ver9x, Version9x, OS, OSystem

' Here is where we interrogate the Operating System
' On Error Resume Next

' Get the computer name dot = this computer.
strComputer = "."
' This is where WMI interrogates the operating system
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMI.ExecQuery("Select * from Win32_OperatingSystem",,48)

' Here we filter Version from the dozens of properties
For Each objItem in colItems
VerBig = Left(objItem.Version,3)
Next

' Spot VerBig variable in previous section
' Note the output variable is called OSystem

Select Case VerBig
Case "5.0" OSystem = "W2K"
Case "5.1" OSystem = "XP"
Case "5.2" OSystem = "Windows 2003"
Case "4.0" OSystem = "NT 4.0"
Case Else OSystem = "Unknown - probably Win 9x"
End Select

' Actual Branching section
If OSystem = "XP" Then
Wscript.Echo " This is where you set XP Group Policy "
Else If OSystem = "Windows 2003" Then
Wscript.Echo " No Group Policy on the server"
Else If OSystem = "W2K" Then
Wscript.Echo " You could set W2K Group Policy "
Else Wscript.Echo " Default group policy "
End If
End If

WScript.Quit

' End of script

 

 

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 (21 day eval).

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

Web  This website

Review of Orion NPMGuy Recommends: Orion's Network Performance Monitor (NPM)

Orion NPM is designed for detecting network outages.

Network-centric views (screenshot) make it easy to see what's working, and what needs your attention.

Download your free trial of Orion's network performance monitor

 

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

Please report a broken link, or an error.