0

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

AA11oAKas
  • 809
  • 1
  • 11
  • 23

1 Answers1

0

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
jbockle
  • 633
  • 5
  • 11
  • Thanks jbockle but i dont it ends up then not finding the field manageddepartment. Would i need to enter the ADAM/LDS location within $root? – AA11oAKas Jan 11 '13 at 22:00
  • within active directory 'maangeddepartment' is not an attribute, but within ADAM/LDS, it is. Not sure if this is this way everywhere or just us? – AA11oAKas Jan 11 '13 at 22:02
  • getDN is just a function used to retrieve the distinguishedName of a user, which ADSI requires. If you know the distinguishedName (ie. LDAP://CN=username,OU=Users,DC=domain,DC=net) you can use that. Try the following command to see what attributes are available: `[ADSI]"LDAP://CN=username,OU=Users,DC=domain,DC=net" | Select *` – jbockle Jan 11 '13 at 22:06