Tuesday, September 16, 2008

Adding Custom Attributes in Active Directory

The main purpose of this document is to add custom attributes in Active Directory. Follow these steps to configure attributes

1. Go to Start -> Run -> Type MMC and press Enter

2. Go to File -> Add/Remove Snap-in -> click Add -> Select Active Directory Schema and click Add. If ‘Active Directory Schema’ is present inside Add Standalone snap-in box switch to step 3 Otherwise follow below three steps.

2. a) Open CommandPrompt. b) Type: regsvr32 schmmgmt.dll

This will get ‘Active Directory Schema’ in Add Standalone snap-in box
Repeat steps 1 and 2 again.Dont Repeat 2a and 2b steps

3. Expand the Active Directory schema and Right Click Attributes

4. Click “Create Attribute” Click “Continue”

5. Create New Attribute window will appear

a) In Common name enter “Sample Test”.
b) Enter LDAP name also as “SampleTest”
c) Get OID please refer http://msdn2.microsoft.com/en-us/library/ms677620.aspx
d) Select the appropriate syntax, which in our case may be String. Assuming that in SampleTest we have all String Values
e) Mention Minimum and Maximum values if required. These are optional you can leave them blank.
f) Once created your attribute will look as below

6.Once Attribute is created, select Classes

7.Expand CLASSES and Select PERSON

8. Rick click PERSON and select Properties

9. Click Attribute Tab and click Add

10. Select the Attribute you created and click OK

11. Click OK to close all property windows

12. Goto Start ->Run -> Type ADSIEDIT.MSC. For running this command you may need to install the support tools from the Windows installation CD

Note: if ADSIEDIT.MSC not open then go to “C:\Program Files\Support Tools” this path and open

13. Open the Active Directory Service Interfaces (ADSI) Edit utility, then navigate to Configuration Container, CN=Configuration

14. Click CN=DisplaySpecifiers

15. Click CN=409

16. In the right-pane, locate and right-click CN=user-display, and select Properties

17. Select AdminContextMenu and click EDIT

18. In the Edit Attribute box, type the following:
7,&SampleTest, c:\Scripts\SampleTest.vbs
Note:7 is the serial number & SampleTest is the Attribute which will appear in User and Computers context Menu C:\Scripts\SampleTest.vbs is the script which will add the value to attribute

Please do not change the Syntax

19. Click OK to close all window popups

20. Select Configuration in ADSIEDIT panel and Right Click

21. Click “UPDATE SCHEMA NOW”

22. These steps configure the options SampleTest on the context menu for a user in the Microsoft Management Console (MMC) Active Directory Users and Computers snap-in

23. You must write and place the following scripts on your C drive or somewhere else in your file path according to step 18:

Dim oVar
Dim oUsr
Dim tmp
Set oVar = Wscript.Arguments
Set oUsr=GetObject(oVar(0))
tmp = InputBox("The value of the user is:" & oUsr.SampleTest & vbCRLF & vbCRLF & "Enter the sample Value")
if tmp <> "" then oUsr.Put"SampleTest",tmp
oUsr.SetInfo
WScript.Quit Then Open “Active Directory Users and Computers” and Right click User,From Context menu select the attribute and enter the attribute value.

No comments: