Is there a way to obtain the groups the currently logged user is a member of via the windows command prompt, or more specifically WSH? I have a script that executes a WSH script that I supply (as a commandline argument) a certain group name if they are in that certain group.
I have tried the test scripts from both
here and
here. WSH gives me the same error ("The specified domain either does not exist or could not be contacted.") in both scripts. The error occurs on the line containing "GetObject("LDAP://RootDSE")". I thought I read somewhere that samba supports using rootDSE, but no matter what I try it does not work. I have also tried using "GetObject("LDAP://cn=Students,dc=domainname,dc=org")", but this gives the same error. Is this task in fact something that is AD-only?
EDIT: I'm going to answer my own question here. After lots of searching, I found a DOS utility called IFMEMBER.exe that can be used to not only detect if a user is in a certain group, but also provide a listing of all groups the user is assigned to. Albeit the second method would require filtering to get the actual group name from each line outputted to stdout by ifmember, but at least it seems to work.