How to count traffic for each mailbox in Exchange


sent = 0
recieved = 0
RecipientTypeDetails =""

$mailboxes=get-mailbox -ResultSize unlimited
foreach ($mailbox in $mailboxes)
$output.sent=(Get-MessageTrackingLog -Start $yesterday -End $tomorrow -Sender (get-mailbox $mailbox).primarysmtpaddress -ResultSize unlimited).count
$output.recieved=(Get-MessageTrackingLog -Start $yesterday -End $tomorrow -recipient (get-mailbox $mailbox).primarysmtpaddress -ResultSize unlimited ).count
$output| export-csv -noTypeInformation -append -path c:\temp\output.csv

Read the rest

how properly enter into maintenance mode on Exchange2016/2013 DAG

Let’s assume that we have

ex01.itforce.local and ex02.itforce.local Exchange 2016 servers in DAG cluster. We need to install new CU on this cluster without downtime. (assumed that all CAS, smtp protocols are properly loadbalanced). So we need:

  1. at first disable all workloads/switch to maintenance mode on the node ex01,
  2. install CU on ex01,
  3. reboot ex01
  4. exit from maintenance mode on ex01
  5. enter into maintenance mode on ex02
  6. install CU on ex02,
  7. reboot ex02
  8. exit from maintenance mode on ex02
  9. equally spread workload on both nodes again
#goto ex01
#run in elevated mode powershell for exchange

#prepare smtp transport:
Set-ServerComponentState ex01 
Read the rest

How to report all hidden mailboxes with related AD user Enable status

# find all hidden mailboxes for whole AD  and show AD user’s Enabled/Disabled status, plus with location (in what OU)

get-mailbox -resultsize unlimited | where {($_.IsMailboxEnabled -eq "True") -and ($_.HiddenFromAddressListsEnabled -eq "True" )} | select-object name, samaccountname, @{N="ADAccount-Is-Enabled"; E={(get-aduser -Identity $_.samaccountname).enabled}}, PrimarySmtpAddress, IsMailboxEnabled , HiddenFromAddressListsEnabled, OrganizationalUnit| export-csv -path c:\temp\hidden.csv -NoTypeInformation
Read the rest