troubleshooting Question

VB.NET - Search Active Directory computers description attribute and return computer name

Avatar of fruitloopy
fruitloopy asked on
Active DirectoryVisual Basic.NET
12 Comments1 Solution1683 ViewsLast Modified:
Background explanation:
We have a logon script that updates the Description attribute of the current logged on computer with the username of the user who just logged in. When a user logs in the computer description attribute will change to display the username:
ExampleI am trying to find the correct way to search all active directory computers description field and return the computer name. This will help us to immediately help a user who phones for support. We dont have to waste time asking them for their computer name, we just ask for their username, type that into the app and it will return the computer name which we can remote to.
This is my code so far:
Dim searchRoot As New DirectoryEntry("LDAP://DC=DOMAIN,DC=local")
        Dim searcher As New DirectorySearcher(searchRoot) With { _
            .Filter = "(objectClass=computer)" _


        searcher.Filter = "(&(objectClass=computer))"
        Dim results = searcher.FindAll

        For Each result In results
            If result.Properties.Contains(txtUsernameSc.Text) Then
            End If

Nothing is returned though.
Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros