First Steps: Basic Script Examples
Imagine you are the system admin of the Active Directory domain 'example.com'. You want to retrieve information concerning objects in the Active Directory from the domain controller 'DC1' - if possible via script. And maybe you even want to alter objects and their attributes.
This is quite easy with the Active Directory Services Interface. Please have a look at the following script examples. If you don't know how Visual Basic scripts work, you could read the introduction for writing and running VBScripts here in the SlefADSI Tutorial first.
First of all we want to have displayed all objects of the OU 'production':
Are you confused about the function GetObject with which we have accessed the AD directory? Then you could read more information about 'Establishing a connection to the directory' in the SelfADSI tutorial.
Or maybe you have got problems with the curios pathname LDAP://dc1.example.com/ou0Fabrikation,dc=example,dc=com? Then you could read the topic 'LDAP Pathnames - Distinguished Names' in the SelfADSI tutorial.
Let's refine our example. Now we want to see all display names of user within the OU:
You wonder how to find out the names of attributes? Please read the detailed description of the attribute 'Class' for user objects. The description of all attributes of the object classes AD User, AD Contact, AD Group and Exchange 5.5 Mailbox are available in the SelfADSI tutorial.
Another situation: For testing purposes you want to create 500 user in the OU 'Test' fast and easily. The following script will do that for you:
Detailed user instruction concerning creating diverse types of objects can be found in the paragraph 'Creating directory objects' here in this tutorial.