'Get users on every windows-machine where Net.Exe is installed '¸2008 by ytwinky, MD Const False=0, True=Not False, Lf=!"\n", Cr=!"\r" Declare Function GetUsers(User As String, byRef Found As Integer=False) As String Dim Found As Integer=True Dim As String Aktuell=Trim(Command(1)), Users=GetUsers(Aktuell, Found) If Aktuell<>"" Then Select Case Chr(Aktuell[0]) Case "/", "-" Print "Auflisten der vorhandenen Benutzer am " &Environ("ComputerName") Print !"Aufruf: NetUser [UserName] [/?]\nWobei: UserName=gesuchter Benutzername" Print !"Wie die Hilfe aufgerufen wird, ist offensichtlich klar ;-))\n(Es reicht -|/).." Print "Desweiteren wird getestet, ob der angegebene UserName erlaubt ist." Aktuell="" End Select End If ' EndIf ist ein Metabefehl aus der Abteilung 'Präprozessoren'^^ Print "Benutzerkonten am " &Environ("ComputerName") &!":\n" &Users; If Aktuell<>"" Then Print !"\n..und " &aktuell &" ist " &*IIf(Found, @"", @"nicht ") &"dabei.."; End Function GetUsers(User As String, byRef Found As Integer) As String Var FNo=FreeFile, i=0, c="", s="", z="", t=lcase(user) Found=False Open Pipe Environ("windir") &"\System32\Net.Exe User" For Input As #FNo 'assign a filenumber to console-output While Not Eof(FNo) 'start reading console-output.. Line Input #FNo, z 'it's not very much, so read it all.. If z<>"" And InStr(z, ".")=0 Then c+=z &Lf 'ignore empty lines(and the last one).. Wend 'console-output reached its end Close #FNo 'finish console-output c=Mid(c, InStr(c, "-" &Lf)+2) 'we only need the part after '----..' Do 'the split.. i=InStr(c, " ") 'is there a space? If i=0 Then Exit Do 'no, done.. z=Left(c, i-1) 'this could be a user name If z[0]<32 Then z=Mid(z, 2) 'phps with a Lf in the beginning(!!!) c=Trim(Mid(c, i)) 'Trim the remainder s+=z &Lf 'collect the users in a string.. If lcase(z)=t Then Found=True Loop 'because there might be more accounts than one LOL Return Left(s, Len(s)-1) 'remove the trailing Lf, avoid errors when splitting by Lf^^ End Function 'wow, done..