Computer Performance, Logon Scripts

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
 

 

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 (21 day eval).

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

Web  This website

Review of Orion NPMGuy Recommends: Orion's Network Performance Monitor (NPM)

Orion NPM is designed for detecting network outages.

Network-centric views (screenshot) make it easy to see what's working, and what needs your attention.

Download your free trial of Orion's network performance monitor

 

Home Copyright © 1999-2009 Computer Performance LTD All rights reserved

Please report a broken link, or an error.