November 25, 2003 at 2:25 pm
Hi!
I'm trying to get the NT group membership of a specified username from TSQL. I'm using the following to query the OS:
SELECT *
FROM OPENROWSET(NetUserGetGroups, @NTUserName) AS NT
It works fine except the fact that it seems that the result is cached somewhere, because if I run it once when a user is member of a certain group it, and then remove the user from the group and rerun the statement, it still reports the user as a group member. Even if I remove the group altogether, it still lists the group.
Any tips on this or alternative strategies?
Brgds
Jonas
BrgdsJonas
November 25, 2003 at 2:53 pm
have a look at IS_MEMBER
* Noel
November 25, 2003 at 2:58 pm
Hi!
Unfortunately IS_MEMBER does not work for me as I have to be able to specify a username different from current user and check membership for it.
Thanks anyway
Jonas
BrgdsJonas
November 25, 2003 at 3:25 pm
How about:
exec master..xp_logininfo N'DomainName\Group', N'members'
Note: The Group Have to Have Access To SQL Server though
* Noel
November 26, 2003 at 12:48 am
Sorry, I should have stated in my original question that I'm using a single account to access the SQL Server from a COM+ application, so the users I want to check NT group memberships for isn't users in SQL Server, only in the NT domain/local computer.
Brgds
Jonas
BrgdsJonas
November 26, 2003 at 10:27 am
Some more investigations has revealed that the time for a group membership change to appear when using this function is between a couple of minutes up to almost ten minutes.
/Jonas
BrgdsJonas
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply