$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://server.domain.dom/PowerShell/ -Authentication Kerberos
import-pssession $session
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin;
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
Get-GlobalAddressList | update-GlobalAddressList
Get-AddressList | update-AddressList
Get-OfflineAddressBook | Update-OfflineAddressBook
Set-AdServerSettings -ViewEntireForest $true
Note: you can check the status by running ‘get-adserversettings’
Set-MailboxAutoReplyConfiguration USERNAME -AutoReplyState enabled -ExternalAudience all -InternalMessage "This account is no longer in use. Please direct all future correspondence to USERNAME@DOMAIN.COM" -ExternalMessage "This account is no longer in use. Please direct all future correspondence to USERNAME@DOMAIN.COM"
Set-Mailbox <alias> -ForwardingAddress <recipient> -DeliverToMailboxAndForward $True
get-mailbox | select PrimarySmtpAddress | where {$_.PrimarysmtpAddress -like "*rolling*"}
get-recipient -resultsize unlimited | select name, emailaddresses
$dist = foreach ($group in (Get-DistributionGroup -Filter {name -like "*"})) {Get-DistributionGroupMember $group | Select @{Label="Group";Expression={$Group.Name}},@{Label="User";Expression={$_.Name}},SamAccountName} $dist | Sort Group,User | Export-csv C:\Services\DL-export.csv -NoTypeInformation
get-publicfolder -identity "\" -recurse
Enable-MailPublicFolder -identity "\PublicFolderPath\PublicFolder"
note: If you want to rcv emails from the outside, you will have to allow anonymous to the public folder and via the DL
Get-mailbox | select DisplayName,ForwardingAddress | where {$_.ForwardingAddress -ne $Null}
Note: make sure to “Change search scope to ‘Entire Forest’”
Get-AdUser Username -Properties * | Select *MSExch*
The following would search all subject, body, and attachments for “9986” and collect results in “john.doe” mailbox in a folder called “cc-9986”
get-mailbox -resultsize unlimited | search-mailbox -searchquery "9986" -targetmailbox "john.doe" -targetfolder "cc-9986"
Get-DynamicDistributionGroup <name> | Format-List Name,RecipientFilter
Set-DynamicDistributionGroup "Washington Management Team" -RecipientFilter {((RecipientType -eq 'UserMailbox') -and (Title -like 'Director*' -or Title -like 'Manager*') -and (StateOrProvince -eq 'WA') -and (Alias -ne $null) -and -not (Name -like "FederatedEmail*"))}
'Rohit','Prateek','Sumit','Ankit' | %{ Get-ADUser -Filter {name -eq $_} -Properties *} | ft Name, @{name='Exchange DB';expression={(($_.HomeMDB).split(',')[0]).split('=')[1]}} ,@{name='Exchange HomeServer';expression={($_.msExchHomeServerName -split 'Servers/cn=')[1]}} -AutoSize
Note: make sure to “Change search scope to ‘Entire Forest’”