(null): 0x80005000 what is this telling me

Have a script which reads in two excell spreadsheets then would like to move computers into the correct OU.  Issue is when I try to set objTargetOU it appears to give me a null value.

WScript.Echo "Moving " & strComputerADsPath & " to " & strOUADsPath
'------Note : Echo returns expected response

Set objTargetOU = GetObject(strOUADsPath)
objTargetOU.Movehere strComputerADsPath, vbNullString

Get a (null): 0x80005000 what is this telling me

 
malcattAsked:
Who is Participating?
 
Bill PrewCommented:
I also notice this note:

"However, you cannot do the same with VBScript. This is because VBScript maps vbNullString to an empty string instead of to a null string, as does Visual Basic. You must use the RDN explicitly, as shown in the previous example."

on the following page:

http://msdn.microsoft.com/en-us/library/aa705991(VS.85).aspx

which seems to indicate that in VBSCRIPT you can't specify vbNullString as the second parm (like you can in VB).

~bp
0
 
Bill PrewCommented:
What are the values of:

strOUADsPath
strComputerADsPath

~bp
0
 
malcattAuthor Commented:
strOUADsPath= "LDAP://" & objOUs(objComputers(strComputer)) & "," & strDNSDomain

which equals LDAP://OU=TESTDEST, DC=tal, DC=dom and we echo it to prove it, yet
 
Set objTargetOU = GetObject(strOUADsPath) gives us the null
 Set objTargetOU = GetObject(LDAP://OU=TESTDEST, DC=tal, DC=dom) does what we want it to do which move opject to this OU.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

 
malcattAuthor Commented:
strComputerADsPath= LDAP://CN=PCN0345,OU=Workstations,DC=tal,DC=dom
0
 
Bill PrewCommented:
The second parm seems to default to NULL if not passed, have you tried:

objTargetOU.Movehere strComputerADsPath

~bp
0
 
malcattAuthor Commented:
Just did without the vbNullString
objTargetOU.Movehere strComputerADsPath
same result unfortunately
0
 
x-menIT super heroCommented:
Are there any special char in the OUs name (like "\")?
0
 
x-menIT super heroCommented:
...or in any other object...
0
 
malcattAuthor Commented:
Just Double Checked, no extra characters
0
 
Bill PrewCommented:
Any chance that this is a permissions problem?  Have you tried using DSMOVE to do this from the command line just to see if it might toss up any other clues?

~bp
0
 
malcattAuthor Commented:
Good thought, unfortunately not this case.  I thought of this also and tested it out.  Moved just fine.  May start over to see if I missed something.  Looked into what you mentioned about vbNullString not being supported, this may have something to do with it.  Thanks for you support
0
 
RobSampsonCommented:
Hi, the GetObject method requires a string.  This would not work

strComputerADsPath= LDAP://CN=PCN0345,OU=Workstations,DC=tal,DC=dom
Set objTargetOU = GetObject(strComputerADsPath

because strComputerADsPath is not a string.

This should work:
Set objTargetOU = GetObject("LDAP://CN=PCN0345,OU=Workstations,DC=tal,DC=dom")

as should this
strComputerADsPath = "LDAP://CN=PCN0345,OU=Workstations,DC=tal,DC=dom"
Set objTargetOU = GetObject(strComputerADsPath)

Is the OU in the same domain that you're running the script on?

Regards,

Rob.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.