Cambiar SMTP principa Exchange PowerShell

Teniamos que cambiar los smtp principales de todo el dominio de correo y utilice el siguiente codigo de powershell

Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.E2010
$mailsold = Get-Mailbox | Select-Object PrimarySmtpAddress
foreach ($mail in $mailsold)
    {
    $mail
    $mailnew= $mail.PrimarySmtpAddress.Address -replace ("Martinezmartinez.EU","Martinez-martinez.eu")
    Set-Mailbox $mail.PrimarySmtpAddress.Address  -EmailAddresses @{add=$mailnew}
    Set-Mailbox $mail.PrimarySmtpAddress.Address  -PrimarySmtpAddress $mailnew -EmailAddressPolicyEnabled $false
    $mailnew
    }

Deja una respuesta

Tu dirección de correo electrónico no será publicada.