Click here to Skip to main content
15,851,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim de As New DirectoryEntry()
            Dim lboolUserExists As Boolean = False
            de.Path = "WinNT://" + paramComputerName
            For Each d As DirectoryEntry In de.Children()
                'If d.SchemaClassName = "Computer" Then MsgBox(d.Name)
                If d.SchemaClassName = "User" Then
                    If d.Name = USER_NAME Then
                        lboolUserExists = True
                        Exit For
                    End If
                End If
            Return lboolUserExists

The above function does not always work for a Network Server and hence I am unable to get a list of Windows users. Please suggest me some solution.


1 solution

What do you mean by "it doesn't always work"? If it works sometimes and not other times, the problem may not even be in your code.
Share this answer

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

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