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.
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
236Loop 237 238 ' Popup message to finish 239 Wscript.Echo "Number of users created = " & numusers
Guy
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.
Thus utility makes it easy to check the health of a router or firewall. Check the real-time performance and availability statistics for any device
on your network.