Secretary And seeAlso attribute

Hi Team. 

Hoping someone may be able to help. I have this script that connects in to ARS and pulls out the SamAccountName , and the first name and last name of the Secretary. That works. However i am unable to do the same for the seeAlso attribute which is a DN attribute like Secretary

Its driving me nuts. Any suggestions?  

Thanks in advance 


Connect-QADService -Service "AR-SERVICE-NAME" -Proxy
$OUName = "OU-DN-HERE"
$CSVName = "C:\Export.csv"

$Report = @()

foreach ($user in (Get-QADUser -SearchRoot $OUName -SizeLimit 0 -IncludedProperties Secretary , seeAlso )) {

    try {
        $Secretary = Get-QADUser $user.Secretary -ErrorAction Stop
        $sName = "$($Secretary.GivenName) $($Secretary.SN)"
    
    }
    catch {
        $sName = ''
    }


     try {
        $ADSeeAlso = Get-QADUser $user.seeAlso -ErrorAction Stop
        $sADSeeAlso = "$($ADSeeAlso.GivenName) $($ADSeeAlso.SN)"
    
    }
    catch {
        $sADSeeAlsoe = ''
    }

    $Report += New-Object PSObject -Property @{
        'samaccountname' = $user.SamAccountName 
        'Secretary' = $sName
        'seeAlso' = $sADSeeAlso
    }
}

$Report | Select-Object samaccountname , Secretary , seeAlso | Export-Csv $CSVName -NoTypeInformation -Force

Parents
  • Have you confirmed that SeeAlso is actually being returned with data queried by Line 7?

    Though not strictly necessary, you could also try to add a line 19:

    $UserToCheck = [string]$user.SeeAlso

    ...and then make Line 20

    $ADSeeAlso = Get-QADUser $UserToCheck -ErrorAction Stop

Reply
  • Have you confirmed that SeeAlso is actually being returned with data queried by Line 7?

    Though not strictly necessary, you could also try to add a line 19:

    $UserToCheck = [string]$user.SeeAlso

    ...and then make Line 20

    $ADSeeAlso = Get-QADUser $UserToCheck -ErrorAction Stop

Children
No Data