Archives par étiquette : Contacts

Modifier les adresses de MailContacts.

Modifier le domaine de l’adresse externe sur tous les MailContacts d’un OU.

$nldomcontact = Get-MailContact -OrganizationalUnit "domain.local/NL" -ResultSize unlimited | Where-Object { $_.ExternalEmailAddress -match "@domino.domain.com" }
foreach ($contact in $nldomcontact){
$extsmtp = "SMTP:" + $contact.alias + "@nl.domain.com"
Set-MailContact -Identity $contact -ExternalEmailAddress $extsmtp
}

Exporter les MailContacts.

Export des MailContacts.


$resfile = New-Item -ItemType file -Path liste_external_contacts.csv -Force

Add-Content -Path $resfile -Value "MailContactDisplayName,MailcontactAlias,MailcontactOrganizationalUnit,MailcontactExternalEmailAddress"

Get-MailContact -ResultSize unlimited | ForEach-Object {

	Add-Content -Path $resfile -Value "$($_.DisplayName),$($_.alias),$($_.OrganizationalUnit),$($_.ExternalEmailAddress)"

}

Exporter les boites avec forwards.

Export des boites aux lettres qui ont des forwards actifs.

$resfile = New-Item -ItemType file -Path liste_forwards.csv -Force

Add-Content -Path $resfile -Value "MailboxDisplayName,MailboxAlias,MailContactDisplayName,MailcontactOrganizationalUnit,MailcontactExternalEmailAddress"


get-mailbox -ResultSize unlimited | Where-Object { $_.ForwardingAddress -ne $null } | ForEach-Object { 
$forward = Get-Recipient -Identity $_.ForwardingAddress
	if ( $forward.RecipientType -eq "MailContact") {
	$mailc = Get-MailContact -Identity $forward.alias
	Add-Content -Path $resfile -Value "$($_.name),$($_.alias),$($mailc.displayname),$($mailc.OrganizationalUnit),$($mailc.ExternalEmailAddress)"
	}
	else {}

}