Managing Exchange using PowerShell

New distribution group
new-distributiongroup -name "Group Name" -Alias "groupalias" -type "distribution" -organizationalunit Groups" -primarysmtpaddress ""

User named: First Last at

New mail contact
New-MailContact -Name "First Last" -ExternalEmailAddress "" -alias "flast"

User named: First Last

New Mailbox and New AD user at the same time
New-Mailbox -Name "First last" -Alias "flast" -FirstName "First" -LastName "Last" -DisplayName "First Last" -OrganizationalUnit "" -UserPrincipalName "" -Password (ConvertTo-SecureString -String 'password_complying_to_ad_password_policy' -AsPlainText -Force)

-Name will be used as the -DisplayName if no display name is specified

List users with no mailbox
Get-User -RecipientTypeDetails User -Filter {UserPrincipalName -ne $null } -ResultSize unlimited
| Enable mailbox for user with no mailbox
Enable-Mailbox -Identity -Alias "flast" -DisplayName "First Last" -Database "mdb01"

-Alias, -DisplayName and -Database aren't mandatory and can be populated automatically

Did the above enabling work? check using:

Get user info
Get-Mailbox -Identity flast | Format-List Name,DisplayName,Alias,PrimarySmtpAddress,Database

Get distribution list members

Get-DistributionGroupMember -Identity GroupName
Enter your comment:
177 +4 = 
  • windows/powershell_commands/exchange.txt
  • Last modified: 2019-10-31 09:06
  • (external edit)