Thanks for all the suggestion, now i have GETSID and GETRID function, and i can retrive the name of Primary Group using 2 ini file, user.ini and group.ini. (i will post solution later)

Now i must find the way to set primarygroupID. I have tried:

$obj = GetObject("WinNT://$Server/$user,user")
? $obj.primarygroupID
$obj.primarygroupID=544 ;RID of Admistrators on my domain
$obj.setinfo
? $obj.primarygroupID
? @SERROR

I have obtained this error (logged as administrator):

COM exception error "setinfo" ((null) - (null)) [-2147352567/80020009]

Searching on net i have fonded this post:

..
There is no way to set primary group via ADSI, you will have to use the
NetUserSetInfo with level 1051 (USER_INFO_1051 struct) to do this. I have
forward this as an enhancement request for the WinNT provider.
..

http://groups.google.com/groups?q=USER_INFO_1051++adsi&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=efx0TVvk8GA.190%40uppssnewspub05.moswest.msn.net&rnum=1

Anyone have an idea?

P.S. I want to use this script to dump user and group and then save all of them in another nt server machine