Created
October 4, 2013 08:03
-
-
Save chdanielmueller/6822522 to your computer and use it in GitHub Desktop.
Powershell Script referenced by http://behind-monitor.blogspot.com/ This Script creates a user in the domain and creates a mailbox. The mailbox is getting configured to receive into the inbox and forward mails to the user's private mail address. Exchange is getting configured to allow automatic forwarding to external addresses.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
This Script creates a user which gets the mails into his company mailbox (contoso.com) and also to his private mailbox (example.com). | |
.DESCRIPTION | |
This Script creates a user in the domain and creates a mailbox. | |
The mailbox is getting configured to receive into the inbox and forward mails to the user's private mail address. | |
Exchange is getting configured to allow automatic forwarding to external addresses. | |
.NOTES | |
FileName : NewMailboxWithForwarding.ps1 | |
Version : 1.0 | |
Author : Daniel Müller (chdanielmueller) | |
Last modified by : Daniel Müller (chdanielmueller) | |
.EXAMPLE | |
Psh> NewMailboxWithForwarding.ps1 | |
#> | |
## Start Script | |
# Ask for password and create user with mailbox | |
$password = Read-Host "Enter password" -AsSecureString | |
New-Mailbox -UserPrincipalName markus.muster@contoso.com -Alias markus.muster -Database "Mailbox Database 1" -Name "Markus Muster" -OrganizationalUnit Users -Password $password -FirstName Markus -LastName Muster -DisplayName "Markus Muster" | |
# Configure mailbox to receive and forward mails | |
Set-Mailbox -Identity "Markus Muster" -ForwardingSmtpAddress "markus.muster@example.com" -DeliverToMailboxAndForward $true | |
# Check and configure Microsoft Exchange to allow automatic forwarding to external addresses | |
Get-RemoteDomain Default | fl AutoForwardEnabled | |
Set-RemoteDomain Default –AutoForwardEnabled $true | |
## End Script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment