Troubleshooting Code 800A01F4 - Variable is undefined
Introduction to Code 800A01F4
Error code, 800A01F4 occurs when you execute a VBScript. This is a
runtime error, check your variables assigned in the Dim statement.
The Symptoms You Get
The script does not execute as you hoped, instead you get a WSH error message.
The Cause of Code 800A01F4
Your VBScript contain is an undeclared variable. Most likely, this is
a spelling mistake in one of your variables.
The clue here is in the Error:.... 'DriveLetter11'. Most likely, this was meant to
be DriveLetter1 and not DriveLetter eleven.
Examine YOUR Windows Script Host message box, and check your Line :.
In my example it's line 12. The Char : is not much use for
error 800A01F4. My point is that rarely is it the very first Char that's at
Incidentally, Source: reports a runtime error not a compilation error, this means you are looking not for a pure syntax problem, but a fault logic error. In the case of runtime errors, you can use this
temporary work around. Add this statement just before the line which errors: On Error Resume Next.
Note: Almost certainly your script has 'Option Explicit' near the top.
The Solution for Variable is undefined
Check the syntax of your script. In my VBScript example, 'DriveLetter11' on Line 12 is the problem. In your example all you need is to read the Error: statement - carefully. Then locate the
code referenced by Line:. Incidentally, Source: reports a runtime error not a compilation error, this means you are looking not for a pure syntax problem, but a fault logic error.
Example of Error Code 800A01F4 Script
Note: Go to Line: 12. DriveLetter11 should be DriveLetter1 (Not Eleven, but One)
' VBScript to map two printers from two servers
' Guy Thomas February 2010.
Dim objShell, objNetwork
Dim DriveLetter1, DriveLetter2, RemotePath1, RemotePath2
Dim AllDrives, AlreadyConnected, Network1, Network2, i
Set Network1 = CreateObject("WScript.Network") DriveLetter11 = "S:" ' This letter must be in CAPITALS.
RemotePath1 = "\\alan\drivers"
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")
Set AllDrives = objNetwork.EnumNetworkDrives()
AlreadyConnected = False
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = DriveLetter1 Then AlreadyConnected = True
If AlreadyConnected = True then
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."
objShell.PopUp "Drive " & DriveLetter1 & " no initial connection"
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.