Discover users that have Notes set

A field like the Notes field can be a dumping ground for all sorts of stuff.  If you want to discover what Notes have been set then try this


"`nMicrosoft"            
Get-ADUser -LDAPFilter "(&(objectclass=user)(objectcategory=user)(info=*))" -Properties *|            
Format-Table Name, DistinguishedName, info -AutoSize -Wrap            
            
"`nAD provider"            
Get-ChildItem -Filter "(&(objectclass=user)(objectcategory=user)(info=*))" `
 -Path Ad:\"DC=Manticore,DC=org" -Recurse |             
foreach {             
 $user = [adsi]"LDAP://$($_.DistinguishedName)"            
 $user | select @{N="Name"; E={$_.name}},             
 @{N="DistinguishedName"; E={$_.distinguishedname}},            
 @{N="Note"; E={$_.info}}            
} | Format-Table -AutoSize -Wrap            
             
"`nQuest"            
Get-QADUser -LDAPFilter "(&(objectclass=user)(objectcategory=user)(info=*))" -IncludeAllProperties |            
Format-Table Name, DN, info -AutoSize -Wrap            
            
"`nScript"            
$root = [ADSI]""            
$search = [adsisearcher]$root            
$search.Filter = "(&(objectclass=user)(objectcategory=user)(info=*))"             
$search.SizeLimit = 3000            
$search.FindAll() | foreach {            
             
$user = $_.GetDirectoryEntry()            
$user | select @{N="Name"; E={$_.name}},             
 @{N="DistinguishedName"; E={$_.distinguishedname}},            
 @{N="Note"; E={$_.info}}            
} | Format-Table -AutoSize -Wrap

Use a LDAP filter to test for the presence of a Notes field and then display the Name, distinguishedname and Note.  The provider and script require us to get a directory entry from the search results before display

Leave a Reply