Declare long NetUserGetInfo In netapi32 ; String @ servername, ; String @ username, ; Long level, ; long @ bufptr Declare long NetUserGetGroups In netapi32 ; String @ servername, ; String @ username, ; Long level, ; Long @ bufptr, ; Long prefmaxlen, ; Long @ entriesread, ; Long @ totalentries Declare long NetUserGetLocalGroups In netapi32 ; String @ servername, ; String @ username, ; Long level, ; Long flags, ; Long @ bufptr, ; Long prefmaxlen, ; Long @ entriesread, ; Long @ totalentries Declare long NetApiBufferFree In netapi32 ; Long Buffer Local lcServerName, lcUserName, lnBuffer, lnIndex, ; lcStrAddress, lnStrAddress, lcUserName, ; lnUGroupCount, lnGroupCount, lcUserGroup *** Set server-computer name and user name bellow: #DEFINE ServerName '\\JEI-Server'+Chr(0) #DEFINE UserName 'Zlatin'+Chr(0) lcServerName = Strconv(ServerName,5) lcUserName = Strconv(UserName,5) lnBuffer = 0 If !Empty(NetUserGetInfo(@lcServerName, @lcUserName, 0, @lnBuffer)) ?'User not found!' Return .f. EndIF lcStrAddress = SYS(2600, lnBuffer, 4) lnStrAddress = asc(left(lcStrAddress, 1)) + ; asc(substr(lcStrAddress, 2, 1)) * 256 + ; asc(substr(lcStrAddress, 3, 1)) * 65536 + ; asc(substr(lcStrAddress, 4, 1)) * 16777216 lcUserName = SYS(2600, lnStrAddress, 256) lcUserName = Strconv(lcUserName,6) lcUserName = Left(lcUserName, At(Chr(0), lcUserName)-1) ?chr(13)+Chr(10)+lcUserName =NetAPIBufferFree(lnBuffer) lcServerName = Strconv(ServerName,5) lcUserName = Strconv(UserName,5) lnBuffer = 0 lnUGroupCount = 0 lnGroupCount = 0 ??' is member of the following ' NetUserGetGroups(@lcServerName, @lcUserName, 0, @lnBuffer, 255, @lnUGroupCount, @lnGroupCount) ??Transform(lnUGroupCount) + [ groups: ]+chr(13)+Chr(10) lcStrAddress = SYS(2600, lnBuffer, 4*lnUGroupCount) For lnIndex = 1 To lnUGroupCount lnStrAddress = asc(substr(lcStrAddress, 1+(lnIndex-1)*4, 1)) + ; asc(substr(lcStrAddress, 2+(lnIndex-1)*4, 1)) * 256 + ; asc(substr(lcStrAddress, 3+(lnIndex-1)*4, 1)) * 65536 + ; asc(substr(lcStrAddress, 4+(lnIndex-1)*4, 1)) * 16777216 lcUserGroup = SYS(2600, lnStrAddress, 256) lcUserGroup = Strconv(lcUserGroup,6) lcUserGroup = Left(lcUserGroup, At(Chr(0), lcUserGroup)-1) ?lcUserGroup Endfor =NetAPIBufferFree(lnBuffer) lcServerName = Strconv(ServerName,5) lcUserName = Strconv(UserName,5) lnBuffer = 0 lnUGroupCount = 0 lnGroupCount = 0 ?chr(13)+Chr(10)+'and is member of the following ' NetUserGetLocalGroups(@lcServerName, @lcUserName, 0, 1, @lnBuffer, 255, @lnUGroupCount, @lnGroupCount) ??Transform(lnUGroupCount) + [ local groups: ]+chr(13)+Chr(10) lcStrAddress = SYS(2600, lnBuffer, 4*lnUGroupCount) For lnIndex = 1 To lnUGroupCount lnStrAddress = asc(substr(lcStrAddress, 1+(lnIndex-1)*4, 1)) + ; asc(substr(lcStrAddress, 2+(lnIndex-1)*4, 1)) * 256 + ; asc(substr(lcStrAddress, 3+(lnIndex-1)*4, 1)) * 65536 + ; asc(substr(lcStrAddress, 4+(lnIndex-1)*4, 1)) * 16777216 lcUserGroup = SYS(2600, lnStrAddress, 256) lcUserGroup = Strconv(lcUserGroup,6) lcUserGroup = Left(lcUserGroup, At(Chr(0), lcUserGroup)-1) ?lcUserGroup Endfor =NetAPIBufferFree(lnBuffer) ?chr(13)+Chr(10)HTH
Make solutions, not programs!