Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VertigoRay/6357306 to your computer and use it in GitHub Desktop.
Save VertigoRay/6357306 to your computer and use it in GitHub Desktop.
try {
foreach ($res in $Search.FindAll())
{
$User = $res.GetDirectoryEntry()
$NewObject = New-Object PSObject
Add-Member -InputObject $NewObject NoteProperty 'DistinguishedName' $User.DistinguishedName
Add-Member -InputObject $NewObject NoteProperty 'SamAccountName' $User.SamAccountName
$OutputList += $NewObject
}
} catch { if ($error[0] -ne $null) {Write-Debug $error[0]} }
$OutputList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment