exchange:linkedunusedforwarding
Dies ist eine alte Version des Dokuments!
Genutzte Linked-Postfächer ohne Nutzeranmeldung
"" > out.csv "" > error.log $mailboxes = Get-Mailbox -Filter {ForwardingAddress -ne $null} $contacts = Get-MailContact -filter {ExternalEMailAddress -like "*@externalDomain.com"} $credDomainA = get-credential -message "Anmeldedaten für DomainA" $credDomainB = get-credential -message "Anmeldedaten für DomainB" foreach ($mailbox in $mailboxes) { $externalAddress = ""; $found = $false; foreach ($contact in $contacts) { if ($contact.Identity -eq $mailbox.ForwardingAddress) { $found = $true; $externalAddress = $contact.ExternalMailAddress; } } if ($found -eq $true) { $ldap = $false; $userarray = $mailbox.LinkedMasterAccount.Split("\"); if ($userarray[0] -eq "DomainA") {$dc = "controllerA.domaina.loc"; $cred = $credDomainA; $ldap = $true} if ($userarray[0] -eq "DomainB") {$dc = "controllerB.domainb.loc"; $cred = $credDomainB; $ldap = $true} if ($ldap -eq $true) { $aduser = get-aduser $userarray[1] -properties lastlogonDate -server $dc -Credential $cred; $ext = $contacts | ?{$_.Identity -eq $mailbox.ForwardingAddress} $aduser.SamAccountName + ";" + $aduser.LastLogonDate + ";" + $ext >> out.csv $aduser.SamAccountName + ";" + $aduser.LastLogonDate + ";" + $ext } else { "Keine Zuordnung für Postfach " + $mailbox.PrimarySMTPAddress + "?" >> error.log "Keine Zuordnung für Postfach " + $mailbox.PrimarySMTPAddress + "?" } } }
exchange/linkedunusedforwarding.1448616410.txt.gz · Zuletzt geändert: 2016/04/02 00:37 (Externe Bearbeitung)