Click here to Skip to main content
16,020,666 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can someone please explain how I can extract the value of extensionattribute15 from a computer account in AD.

My code looks a bit like this:

Public Function funGetWorkstation(ByVal strWorkstationID As String)
    
Dim dirEntry As New DirectoryEntry("LDAP://RootDSE")
    
Dim strRoot As String = "LDAP://(My Network);
    
dirEntry = New DirectoryEntry(strRoot)

    Dim mySearch As DirectorySearcher = New DirectorySearcher(dirEntry)

    mySearch.Filter = "(&(ObjectClass=computer)(CN=" & strWorkstationID & "))"

    Try
        For Each workstation As SearchResult In mySearch.FindAll()

            Dim strWSObject = workstation.GetDirectoryEntry

            Dim strOU = strWSObject.Parent.Parent.Name.ToString

            Dim strOffice = strWSObject.Parent.Parent.Parent.Name.ToString

            TextBox2.Text = Microsoft.VisualBasic.Mid(strOU, 4)

            TextBox4.Text = Microsoft.VisualBasic.Mid(strOffice, 4)
        Next

    Catch ex As Exception

        MsgBox("It didnt work")

    End Try

    Return True

End Function


All this bit works, what I can't manage to do is find the ExtensionAttributes within strWSObject or how I can go about extracting them if they're not by default.

Thanks.
Posted
Updated 13-May-10 14:55pm
v2

1 solution

It's ok, I've figured it out, just needed to add this line.

Dim ext1 = strWSObject.Properties("extensionattribute15").Value 



Thanks for looking.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900