Get the App
SLTechnology News&Howtos  ›  Database  › 

Exchange powershell notes

Shulou Source: shulou.com Published: 2022-06-01 10:58:12 10月04日 Update

Query all disabled domain accounts and transfer them to an OU in batches

get-aduser -Filter * -SearchBase "DC=contoso,DC=com" | foreach {if ($_.enabled -eq $false){$_.ObjectGUID} } | Move-ADObject -TargetPath "OU=deluser,OU=delusers,DC=Contoso,DC=com"

Count the number of user mailboxes in ExchangeDB database

Get-Mailbox -ResultSize unlimited | Group-Object -Property:Database | Select Name,Count

View the usage of user mailboxes in a database (for example, database name is database01), and arrange them in order of mailbox size. Replace database with server to query server mail statistics.

Get-Mailbox -Database "IT" |Get-MailboxStatistics | Sort TotalItemSize |ftDisplayName,ItemCount,TotalItemSize

Count the sending situation of a HUB server in a time period:

Get-MessageTrackingLog-ResultSize unlimited -Start "07/01/2012" -End "07/13/2012"-EventId "send" -Server "srvbj06" |Measure-Object

ResultSizeunlimited parameter is Display All.

Add Measure-Object to the sum of numeric attributes of the computed object and string objects. Remove it and it will be displayed one by one.

View existing Exchange 2010 database sizes

Get-MailboxDatabase -Status | ft ServerName,Name,DatabaseSize

Query the total number of boxes in a database or server

Get-Mailbox -database dbname | Measure-Object

Get-Mailbox -Server servername | Measure-Object

Tags: Data database server mailbox service query statistics size object user usage parameter character string attribute sum total situation number time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia Huawei MariaDB Shulou Technology