Powershell pulling LDS/ADAM attribute values

2.3k Views Asked by At

i'm working on pulling user attributes from an ADAM environment, specifically i need 'manageddepartmentnumber' and 'manageddepartment.' after hours though, i'm still at a loss of what's the best way to pull this information??

currently attempting

Connect-QADService -service 'directory.blah.com'
Get-QADUser -Name 'sam*'

this ofcourse... doesnt work. Any help is greatly appreciated.

Thanks

1

There are 1 best solutions below

3
jbockle On

Would suggest using [ADSI], example:

FUNCTION getDN {
[CmdletBinding()]
Param(
    [Parameter(
    Mandatory=$True,
    Position=0,
    ValueFromPipeline=$True
    )]
    [String[]]$name
)
$root = [ADSI]''
$searcher = New-Object System.DirectoryServices.DirectorySearcher($root)
$searcher.Filter = "CN=$name"
$adfind = $searcher.FindAll()
RETURN $adfind[0].Path
}

$username = "john.doe"
([ADSI]$(getDN $username)).manageddepartment