SQLTeam.com | Weblogs | Forums

Active directory get user and groups



i am looking for a query that i get all usersr and their group .
i mean like

user1 group1
user1 group2
user1 group3
user2 group1
user3 group2



Look up xp_logininfo in BOL. Using it, it should be possible to walk through all of your Users/Logins to get all of the Windows groups and their members.



i need a query that have a SELECT * FROM ......



see sys.server_principals


i need all users and their group that belong to from AD
(not just sql users)


So your requirement has nothing to do with SQL Server at all ?


i need to do it by SQL

i want to get a list of
1.users from AD and their group
2.users from olap and their roles


But not SQL Server. SQL Server will not contain and will not be able to provide the AD to you.

You will get better answer at other forum like stackoverflow or superuser. SQLTeam is on Microsoft SQL Server


but you can pull out data by create link server.


why not using powershell