Monthly Archive

Reading direct reports

As stated last time the direct reports is a backlink created from the users who have this particular user as a manager

Displaying this attribute is straight forward

if (-not (Get-Module ActiveDirectory)){            
  Import-Module ActiveDirectory            
}            
            
$ou = "OU=England,DC=Manticore,DC=org"            
$manager = "CN=HORNBLOWER Horatio,$ou"            
            
"`nMicrosoft"            
Get-ADUser -Identity $manager -Properties * |             
select -ExpandProperty directReports            
            
            
"`nAD provider"            
Get-ItemProperty -Path AD:\$manager  -Name directReports |             
select -ExpandProperty directReports            
             
"`nQuest"            
Get-QADUser -Identity $manager -IncludeAllProperties |             
select -ExpandProperty directReports            
            
            
"`nScript"            
$user = [adsi]"LDAP://$manager"            
$user |             
select -ExpandProperty directReports

No real surprises – get the user and display the property. Its a collection so using –ExpandProperty is the easiest way to display

Leave a Reply