Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query to list users in a Windows 2000 Server users group

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-11-03 : 07:50:46
Mike writes "Is there a way to right a query to list all the users in a users group stored on a Windows 2000 Server?"

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-11-03 : 15:35:09
You would need to call an API to do this. It would take some work to be able to call it from SQL Server? But why would you want to?

Tara
Go to Top of Page

jasper_smith
SQL Server MVP & SQLTeam MVY

846 Posts

Posted - 2003-11-03 : 16:36:23
If the group login is granted access to SQL then you can use
exec xp_logininfo 'MYDOMAIN\MYGROUP','members'

If not then you can create a procedure to do this. Please note that this is not really supported as it marks the procedure as a system object
USE Master
GO

EXEC sp_configure 'allow updates', 1
RECONFIGURE WITH OVERRIDE
GO

EXEC sp_ms_upd_sysobj_category 1
GO

CREATE PROC xp_GetNTGroupMembers
@acctname sysname --IN: NT group name
AS
SELECT Name
FROM OPENROWSET(NetGroupGetMembers, @acctname) AS NT
GO

EXEC sp_ms_upd_sysobj_category 2
GO

EXEC sp_configure 'allow updates', 0
RECONFIGURE WITH OVERRIDE
GO

Go to Top of Page
   

- Advertisement -