Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GetObject error for newbie

8 views
Skip to first unread message

David

unread,
Nov 3, 2009, 12:58:10 PM11/3/09
to
I am just starting to work with windows scripting and ADSI, and trying some
of the examples found in the TechNet doucumentation.

Here is my script:
Set objUser = GetObject("LDAP://cn=david,dc=ectax,dc=escambia")
ectax.escambia the domain and david being a user account in the AD.

and error:
getdomainuser.vbs(1, 1) (null): There is no such object on the server.

The sample code in the doc also includes an OU parameter. in our case there
are no OU's under the domain so that was left out of my getobject statement.


I can remove the cn parameter and the object for the domain is created with
no errors.

thanks for any help
David


jonny

unread,
Nov 15, 2009, 4:05:51 AM11/15/09
to
Hi David,


Basics are : Have you installed that stuff?
If you have. Post some easy success.
--------------------------------------------------------
Then ask a aquestion .
--------------------------------------------------------

You sound like when the coffee machine,
creamer, spoon, cup, partience, time, room in
your trash can, electricity, and propery tax
to run it, came with FOX TV, Obama Ethics,
and what else your mind escaped to become question.

Be valid. Be a questioner.

wsh is the strongest 2 bill+ audience there is on the planet.


FOR ALONG TIME.

"David" <Da...@discussions.microsoft.com> wrote in message
news:BF6C0A3F-3AD6-43E7...@microsoft.com...

Richard Mueller [MVP]

unread,
Nov 15, 2009, 11:40:07 AM11/15/09
to
David wrote:

You need to find the correct binding string to bind to the user object. The
binding string you used above assumes that the object with Common Name
"david" is in the root of the domain ectax.escambia, which is not likely. If
you have no Organizational Units, then most likely your user objects are in
the default container, "cn=Users". You might try:

Set objUser = GetObject("LDAP://cn=david,cn=users,dc=ectax,dc=escambia")

It is also possible that "david" is the "pre-Windows 2000 logon" name of the
user, but the Common Name is something else. To get used to the
Distinguished Names in your domain it might help to run a script that dumps
out the names of all user's. The binding string you need to bind to the user
object is the Distinguished Name, plus the moniker "LDAP://". For example,
if all of your users are in the "cn=Users" container, you could run the
following (at a command prompt):
=======
' Bind to cn=Users container.
Set objContainer = GetObject("LDAP://cn=Users,dc=ectax,dc=escambia")

' Filter on user objects.
objContainer.Filter = Array("user")

' Enumerate all user objects in the container.
For Each objUser In objContainer
Wscript.Echo objUser.distingishedName
Next
====
Or, if you have OU's and containers you can run a VBScript program that uses
ADO to query for all users and output their Distinguished Names. The example
linked below creates a text file with the Distinguished Names of all users
in the domain:

http://www.rlmueller.net/Create%20User%20List%202.htm

You pass the name of the file as a parameter to the program and it creates
the file with the names. Alternatively, if you have a Domain Controller with
Windows Server 2003 or above, you can use the dsquery utility to dump out
the Distinguished Names of all users. At a command prompt on the DC use:

dsquery user

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--


0 new messages