Is it possible to list all users in a TFS group from SQL Server

依然范特西╮ 提交于 2019-12-10 13:00:05

问题


I am trying to recover some group membership information from an old TFS 2010 server for which the application tier is no longer available (but the SQL back-end has not yet been deleted). I know there are command line programs to get security information but I am wondering if it is possible to get security information (specifically group membership) given only the database tables/views.


回答1:


Here's a query I use to list all users and memberships within a TFS Collection.

Select    Object1.DisplayName as Name, 
          Object2.DisplayName as Membership
From      ADObjectMemberships Member1, 
          ADObjects Object1,
          ADObjects Object2
Where     Object1.ObjectSID = Member1.MemberObjectSID and
          Object2.ObjectSID = Member1.ObjectSID
Order By  Membership, Name



回答2:


After poking around and some trial-and-error, I found that the following SQL seems to work

USE MyCollection;

SELECT
   --grp.[SamAccountName] 'group_name',
    member.SamAccountName 'member_name'
FROM
    [ADObjects] grp
    JOIN ADObjectMemberships om ON om.ObjectSID = grp.ObjectSID
    JOIN ADObjects member ON om.MemberObjectSID = member.ObjectSID
WHERE
    grp.SamAccountName = 'MyGroup'


来源:https://stackoverflow.com/questions/28371723/is-it-possible-to-list-all-users-in-a-tfs-group-from-sql-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!