Szczegolowy opis funkcji

0

Witam

Czy moglby mi ktos powiedziec jak dziala ta funkcja. Z gory dziekuje

 Public Function GetLocalUsers(ByVal MachineName As String) As List(Of String)

        Dim count As Integer = 0
        Dim user_accounts As New List(Of String)

        Dim WinNt As New DirectoryServices.DirectoryEntry("WinNT://" & Environment.MachineName.ToString)

        For Each User As DirectoryServices.DirectoryEntry In WinNt.Children
            If User.SchemaClassName = "User" Then
                If (User.Name = "Administrator") Then
                Else
                    user_accounts.Add(User.Name)
                    count = count + 1
                End If


            End If
        Next

        Me.countUserAccounts = count
        Return user_accounts


    End Function
 
0

A czego nie rozumiesz?

Metoda zwraca listę (stringów) użytkowników którzy mają nazwę inną niż "Administrator".

0

Wiem ze zwraca liste uzytkownikow ale nie wiem jak to dziala. Nie wiem co to jest winnt i directory services?

1

System.DirectoryServices

The System.DirectoryServices namespace provides easy access to Active Directory Domain Services from managed code. The namespace contains two component classes, DirectoryEntry and DirectorySearcher, which use the Active Directory Services Interfaces (ADSI) technology.

WinNT User Object/WinNT ADsPath

WinNT User Object. The WinNT User object represents a user account in a Windows NT 4.0 domain.

WinNT ADsPath. The domain name can be either a NETBIOS name or a DNS name.
The server is the name of a specific server within the domain.
The path is the path of on object, such as "printserver1/printer2".
The object name is the name of a specific object.
The object class is the class name of the named object. One example of this usage would be "WinNT://MyServer/JeffSmith,user". Specifying a class name can improve the performance of the bind operation.

0

Dzieki za pomoc

1 użytkowników online, w tym zalogowanych: 0, gości: 1