How to query Active Directory for all employees directly and indirectly reporting to a general manager?

Anonymous
2023-09-27T22:44:52+00:00

For internal billing purposes, we need to find all the employees directly and indirectly reporting to the general manager.

For example, the general manager is item A in LDAP (Active Directory), and

  • item B has property "manager=A", so B directly reports to A.
  • Moreover, item C has property "manager=B", so C reports to A as well, indirectly. In the mini example, general manager A's team includes B and C. To start from the general manager's item in LDAP and iteratively find all the employees under him through the relation of "manager=xxx" property. The data structure is like a multi-children tree, and our first thought is to write a python script and implement a BFS (breath-first search).

Our Question: However, before re-inventing any wheels, we hope to double-check whether there is a way to do it within the built-in functions and tools.We highly appreciate any hints and suggestions.

Windows for business | Windows Server | Directory services | Active Directory

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.

0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-09-28T06:30:56+00:00

    Hello yzgoa,

    Thank you for posting in Microsoft Community forum.

    For checking the organization relationship for reporting to the general manager.
    I have viewed in my lab.

    I have set four people in lab.

    The organizational relationship from low to high is:
    t2-xiashu\t2\t2-manager\t2-manager-manager

    I have set manager for t2-xiashu and t2 and t2-manager.

    I can only see directly reporting to a general manager for all employees, but I cannot see indirectly reporting to a general manager.

    For example:

    The manager of t2-xiashu is t2.

    Image
    https://filestore.community.support.microsoft.com/api/images/eb55e1c6-2f2e-42db-982c-25a5110b6011?upload=true&fud_access=wJJIheezUklbAN2ppeDns8cDNpYs3nCYjgitr%2BfFBh2dqlqMuW7np3F6Utp%2FKMltnRRYFtVjOMO5tpbpW9UyRAwvLeec5emAPixgq9ta07Dgnp2aq5eJbnfd%2FU3qhn54Ui9c7IY3%2BVaDGM794ieFEWFOTytTrMKy7m1XQpeIKlfhHZvv6qxFNypZh8EVO%2BjzMgLRnj7SrY%2FjVoV7qs8fDiK994oMxVrhrFAMYDcU%2FzrBrBDVQE%2BZzYuO0rQIGgxR98AeGi8%2B8Qne%2BIp4ZFCvrrZackjpoMogKVQnseQeB7FtJqaBqH0KfH0CPy9DNQJoMX%2BdRUcGd2luk8dclBoIHxT2uNae0Wd1V8CGPYymsMbNQKVIyw0Z4F2ZUm9FSg75b9XQuTVhnkXM8hJ99Gb%2Fh8DkdWMD1aZJlVIjZo5Gzr0%3D

    The manager of t2 is t2-manager.

    Image

    The manager of t2-manager is t2-manager-manager.

    Image

    Image

    Meanwhile, I can see all the directly and indirectly reporting to a general manager for all employees under organization tab in Teams.

    Image

    For the last option for you, maybe you can query the information you need via Teams team engineers.

    I hope the information above is helpful.

    If you have any question or concern, please feel free to let us know.

    Best Regards,
    Daisy Zhou

    0 comments No comments