set procedure to clsheap additive oheap = createobject("Heap") Declare Integer NetLocalGroupAddMembers ; In NetApi32 String ServerName, ; String GroupName , ; Integer Level , ; String @Buf , ; Integer TotalEntries cServerName = strconv(strconv("\\TCPPT23",1),5)+chr(0) && Name of my Win NT 4 server cGroupName = strconv(strconv("Administrators",1),5)+chr(0) && Name of the group nLevel = 3 nTotalEntries = 1 cBuf = NumtoDWORD(oHeap.AllocString(strconv(strconv("TCPPT23\TUser",1),5)+chr(0))) && DomainName\AccountName * oheap.AllocString returns the memory address of where the string was stored * NumtoDWORD returns a string representation of the address of the pointer nResult = NetLocalGroupAddMembers (cServerName , ; cGroupName , ; nLevel , ; @cBuf , ; nTotalEntries) MessageBox (Str (nResult))HTH.
>*To add a member to a group =============================== > > Declare Integer NetLocalGroupAddMembers ; > ; > In NetApi32 String @ServerName, ; > String @GroupName , ; > Integer @Level , ; > String @Buf , ; > Integer @TotalEntries > > cServerName = "\\MU005873" && Name of my Win NT 4 server > cGroupName = "GrupoTeste" && Name of the group > nLevel = 3 > cBuf = "\\MU005873\UsuarioTeste" && DomainName\AccountName > nTotalEntries = 1 > > nResult = NetLocalGroupAddMembers (cServerName , ; > cGroupName , ; > nLevel , ; > cBuf , ; > nTotalEntries) > > MessageBox (Str (nResult)) > >*To remove a member a from a group ======================== > > Declare Integer NetLocalGroupDelMembers ; > ; > In NetApi32 String @ServerName, ; > String @GroupName , ; > Integer @Level , ; > String @Buf , ; > Integer @TotalEntries > > cServerName = "\\MU005873" > cGroupName = "GrupoTeste" > nLevel = 3 > cBuf = "\\MU005873\UsuarioTeste" > nTotalEntries = 1 > > nResult = NetLocalGroupDelMembers (cServerName , ; > cGroupName , ; > nLevel , ; > cBuf , ; > nTotalEntries) > > MessageBox (Str (nResult)) > > Clear DLLs > >*========================================================== >