Get Mail fqdn from Notes-User

Posted on: October 15, 2016 Posted by: Philipp Comments: 0

Get Mail fqdn from Notes-User

Hier kleines Codeschnipsel welches die Mail-Domänen von NotesUser auswertet und deren Häufigkeit zählt.

Die Rückgabe sieht wie folgt aus:

demo1.de count = 1
demo2.de count = 296
demo3.de count = 189


$Notes_AuthenticationType = "Anonymous"
$Notes_Such_Filter = "((uid=*))"
$Notes_LDAP = "LDAP://LDAP-SERVER:389"

#Region GetNotesUser
$Notes_AuthenticationType = "Anonymous"
$Notes_Such_Filter = "((uid=*))"
$auth = [System.DirectoryServices.AuthenticationTypes]::$Notes_AuthenticationType
$Root = new-object system.directoryservices.directoryEntry ("$Notes_LDAP","","",$auth);
$Searcher = New-Object Directoryservices.DirectorySearcher($Root)
$searcher.Filter = $Notes_Such_Filter
$searcher.Searchscope = [System.DirectoryServices.SearchScope]::Subtree
$Result = $searcher.findAll()
#EndRegion

$mail = $Result.Properties.mail  | foreach {($_.split("@"))[1]}
$unique = $mail| sort-object –Unique
foreach ($obj in $unique){"$($obj) count =  $(($mail | where {$_ -eq $obj}).count)"}