Random Message...there is no such object on the server ????

  • Thread starter Thread starter barabba
  • Start date Start date
B

barabba

Hi guys,

I wrote a long vbscript that takes care of migrating our corporate
users from an old to a new active directory infrastructure.

The problem I encounter is the following:

When I bind to the user using the canonical method:

Set oUser = GetObject ("LDAP://" & strDisplayLine)

The variable strDisplayline contains the distinguished name of the
user I want to migrate.

The problem is that I can run the script three times without problems,
then the 4th time I run the script....I get this error... !
Sometimes I get it every other time I run the script (once ok, once
not, once ok, and so forth).

Anybody knows what could be the reason of this behaviour ?

Thanks
Bar
 
Hi Barabba,

The most common cause of the "no such object on server"
error message when scripting for ADSI is that you have not
bound correclty to the container which houses the object
that you want to move. Presuming that the RDN you have
specified within the variable strDisplayLine is correct
ie. strDisplayLine = "cn=<name of object>" then the cause
may be that you need to correctly bind to the parent
conatiner. I tend to use the variable strContainer to hold
the RDN of the container I am binding to as the parent.

The following code can be used for the binding operation:

strContainer = "<whatever>"

If strContainer = "" Then

Set objContainer = GetObject("LDAP://" & objRootDSE.Get
("DefaultNamingContext"))

Else

Set objContainer = GetObject("LDAP://" & strContainer
& "," & objRootDSE.Get("DefaultNamingContext"))


Obviously, the variable objRootDSE needs to be assigned:

Set objRootDSE = GetObject("LDAP://RootDSE")


You must have the code correct for the actual moving of
the object, as it does work for some of the time, but it
looks like you are not binding correctly to the container.

You may wish to qualifying the variable strDisplayLine in
a more explicit way by using:

strDisplayLine = "cn=<name>,ou=<name>,dc=<name>,dc=<name>"

This can help in situations where cross-domain transfers
are taking place, but you have not specified exactly what
the move operation involves.

The above is intended as a general guide. Without seeing
the full code it would be difficult to pin down the issue.

Hope this helps.

Regards,

Stuart M. Williams.
 
Back
Top