Computer Performance, Logon Scripts

Code Error 800A03F4 - Variable is undefined

Troubleshooting Code 800A03F4 - Variable is undefined

Introduction to Code 800A03F4

Error code 800A03F4 occurs when you execute a VBScript.  To be blunt this is due to carelessness.  Either you have not declared a variable at all, or you have misspelt it later in the script.Code 800A03F4 Error: Variable Undefined

The Symptoms you get

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

The Cause of Error 800A03F4

Code 800A03F4 means that you are using Option Explicit but you have not declared a variable as a Dim Statement in your script.  Note that the Source: is a runtime error (and not compilation error).

The Solution to Variable is undefined

The key to solving error 800A03F4 is reading the reference, 'Error: Variable is undefined: 'xyz'.  In my example 'xyz' is 'numusers'.  You could also double check to see if you are using Option Explicit.  If so, then you need to declare the variable mentioned in the error message.  In my example, Windows Scripting Host is telling us that the problem is at Line: 239, in addition to regular lines, count blank lines and lines with remarks. 

Beware you may, as in my example have correctly declared a similar variable, and all this error is a typo, 'numusers' instead of 'intNumusers'.   My point is that declaring 'numusers', would stop the error message but would result in a faulty script.  Preventing such problems is the reason I have Option Explicit alert me to potential logical errors.

In this case the Char: number (1), may not be the place on the line where the variable is found, so check the whole line.

Example of Error 800A03F4 Script

You can see Dim statements at the beginning of the script, also observe that Option Explicit is set at the beginning of the script.

 

Option Explicit

' Objects
Dim objRootDSE, objTrans, objFSO, objShell
Dim objExcel, objSheet
Dim objUser, objGroup, objContainer

Dim intNumusers

 

 

Then go to line 239 and see the variable numusers, this is the root cause of the problem.  The solution is, either  declare this variable at the start or, as it is a typo, alter numusers to intNumusers

'.....Cut to line line 231

231  End If
232  ' Increment to next user.
233  intRow = intRow + 1
234  intNumusers = intNumusers + 1
235

236  Loop
237
238  ' Popup message to finish
239  Wscript.Echo "Number of users created = " & numusers
 

 

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.