Computer Performance, Logon Scripts

Code  800A01F4 - Variable is undefined

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.Error 800A01F4 Variable is undefined - Windows Script Host

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 fault. 

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.

Marcos reports this error, 800A01F4 in an ASP file calling a JavaScript function.

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 2004.
' ******************************
Option Explicit


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
Next

If AlreadyConnected = True then
objNetwork.RemoveNetworkDrive DriveLetter1
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."

Else

objShell.PopUp "Drive " & DriveLetter1 & " no initial connection"

End if

objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objShell.PopUp "Drive " & DriveLetter1 & " connected successfully."

WScript.Quit
' End of Error Code 800A01F4  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

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.