简体   繁体   中英

LDAP Query to extract user with their complete Manager details

Could you please guide me how to export user details from a certain group in AD along with organisation details (complete reporting hierarchy) to csv?

Example:

在此处输入图像描述

Regards Aravind Viswanathan

I played a bit and figured out this will work, if you need more help exporting let me know

    
Get-ADUser username -Properties Manager |foreach {
  $manager = $_.Manager 
 do
 {
  $manager = Get-ADUser -Identity $manager -Properties Manager -ErrorAction 
SilentlyContinue  

  $manager.name 
    $manager = $Manager.Manager
       
 pause
}
#do this until there is no more manager
until ([string]::IsNullOrEmpty(  $Manager))
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM