Get a Users Primary Group
Keywords: Get Users Primary Group
Question:
I'm trying to get the primary group of the current user, with wntUserGetDat I get the ID of the group. How can I get the name of this ID?AddExtender("WWWNT34i.DLL") ; current user vUser=wntGetUser(@default) Message("Current user =",vUser) vDomain=StrUpper(Environment("USERDOMAIN")) ; PDC vPDC=wntGetDc( "",vDomain, 1) Message("PDC =",vPDC) ;DC vDC=wntGetDc( "",vDomain, 0) Message("DC =",vDC) ; Primary group vPrimaryGrp=WntUserGetDat(vPDC,vUser,"primary_group_id") Message("Primary Group =", vPrimaryGrp)Answer:
Continue on with the following as an extension to your existing code...vDomainSID = wntLsaPolGet(vPDC,"PrimaryDomain",2) vPrimaryGrpName = wntAcctInfo(vPDC,StrCat(vDomainSID,'-',vPrimaryGrp),2,0) Message("Primary Group Name =",vPrimaryGrpName)
Article ID: W15195