Error 800A01C2 – Wrong number of arguments of invalid property assignment.

Troubleshooting Error 800A01C2 – Wrong number of arguments of invalid property assignment.

Error 800A01C2 is a tricky problem.  Check to see if your script needs an extra ‘Set’ Command

Introduction to Code 800A01C2

Error code, 800A01C2 occurs when you execute a VBScript.  This is a runtime error, therefore check the names of your objects.  Error 800A01C2 - Object not a collection

The Symptoms You Get

The script does not execute as you had hoped. Instead you get a message box like this picture:  (Screen shot kindly sent in by Jim Wells.)

The Cause of Code 800A01C2

The best clue to the error comes at the end of the line, the word ‘objUser’.  objUser is a valid object and term, therefore we need to investigate what is missing.  I solved the problem by comparing with another script, which executed perfectly.  It turned out that ‘Set’ was required in front of objUser.

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 Wrong number of arguments of invalid property assignment.

Check the names in your script, pay particular attention to object names.  Note: The Line: 6 Char: 1  In this case it is not Char 1 to blame, more that there is something wrong and none of the line can execute.  In this case it should be Set objUser =

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

  ‡

Example of Error 800A01C2 Script

Note: The Line: 6 objUser

The script needs a ‘Set’ command before objUser

‘CREATE USER AND SET PASSWORD
strcn = bilbo56
strsam= bilbo56
strpasswd = pauline1
Set objOU=GetObject("LDAP://ou=Droitwich,dc=cp,dc=com")
objUser = objOU.Create("User","cn=bilbo56")
objUser.Put "sAMAccountName","bilbo56"
ObjUser.SetInfo
objUser.SetPassword strpasswd

Corrected Version

‘CREATE USER AND SET PASSWORD
strcn = bilbo56
strsam= bilbo56
strpasswd = pauline1
Set objOU=GetObject("LDAP://ou=Droitwich,dc=cp,dc=com")
Set objUser = objOU.Create("User","cn=bilbo56")
objUser.Put "sAMAccountName","bilbo56"
ObjUser.SetInfo
objUser.SetPassword strpasswd

 

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