Code Error 800A01F5 – Illegal assignment

Troubleshooting Code 800A01F5 – Illegal assignment

Very tricky error.  The clue is in the name after Error: in the message box.

Introduction to Code 800A01F5

Error code, 800A01F5 occurs when you execute a VBScript.  This is a runtime error, check your objects and strings.Code 800A01F5 Illegal assignment WSH Script

The Symptoms You Get

The script does not execute as you had hoped. Instead you get a WSH message box like this picture:

The Cause of Error 800A01F5

Your VBScript contain is a misuse of a string or object variable.  The clue here is in the ‘strComp’.  What could be wrong?  In the case of this WSH error the logic is faulty, what is required is an object property, not a str = string property. 

Paul DeBrino also reports that trying to set a variable which had previously been defined as CONST also results in Error 800A01F5.

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.

The Solutions

Check the syntax of your script.  In my VBScript example line 7 is the problem.  With WSH error messages, Char 1, is often unreliable, the problem could be anywhere on that line.

Check your variables, none should also be CONST.

As a last resort, in the case of runtime errors, you can add this line:
On Error Resume Next.

  ‡

Example of Error 800A01F5 Script

Note: The Line: 7
strComp = OurNetwork.Username. 

The problem is that you cannot set a variable to be equal to this particular property (.Username).  As the error messages says, this is an illegal assignment.

 

‘ Error 800A01F5 VBScript to to Enumerate your mapped drive
‘ Guy Thomas February 2010.
‘ ******************************
Set OurNetwork = WScript.CreateObject("WScript.Network")
Set objDrives = OurNetwork.EnumNetworkDrives
‘ WScript.Echo OurNetwork.Username &" ‘s Network drive mappings:"
strComp = OurNetwork.Username
WScript.Echo strComp
WScript.Quit

 

See More Windows Update Error Codes 8004 Series

Error 800A101A8 Object Required   •Error 800A0046   •Error 800A10AD   •Error 800A000D

Error 80048820   •Error 800A0401   •Review of SolarWinds Permissions Monitor

Error 80040E14   • Error 800A03EA   • Error 800A0408   • Error 800A03EE

Solarwinds Free WMI MonitorGuy 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.

Download your free copy of WMI Monitor


Do you need additional help?

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:

If you like this page then please share it with your friends