Tuesday, 29 December 2015

Microsoft Exchange EMS usefull commands(Handy for troubleshooting) help for Exchange Admins

Get-ExchangeServer
As with most PowerShell cmdlets you can control the output display by piping the output into Format-List (or Format-Table).

Get-ExchangeServer -Identity ExSv1 | Format-List

Note 2:  If you want to focus on just one server append the -Identity parameter.
List the Get-ExchangeServer Parameters

Extend your scripting capabilities by getting to know more parameters:

Get-Help Get-ExchangeServer

Use the information to specify the status because it forces the cmdlet to include real-time information.  For example, try this script with and without the -Status switch.

Get-ExchangeServer -Identity ExSv1 -Status | Format-List


----------------------------------------------------------------

Test-servicehealth

Will test all the services running and tells us about the services that are not runnung. Helpfull for troubleshooting.



------------------------------------------------------------------


get-command -noun add*
will show all commands with noune "add"

get-command -verb test*
will show all commands with verb "test"

get-help test-servicehealth -examples
will privide help with examples regarding the specific command test-servicehealth

---------------------------------------------------------------------


gpresult /v command is very useful to check the gpo being applied and also to troubleshoot regarding GPO's.


------------------------------------------------------------------------

If you need to check the white space

Get-MailboxDatabase Database1 -Status | FL AvailableNewMailboxSpace

Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto

------------------------------------------------------------------------
administrative share checking command:
You can see your shared folders by going to Start >Run > type fsmgmt.msc > Shared Folders

------------------------------------------------------------------------

to check the version of exchange



Get-Command Exsetup.exe | ForEach-Object {$_.FileVersionInfo}

-------------------------------------------------------------------------

to check the mailbox whitespace

Get-MailboxDatabase -Status | ft name,databasesize,availablenewmailboxspace -auto

---------------------------------------------------------------------------

to check the version service pack sp of exchange

Get-ExchangeServer | select name,admindisplayversion


--------------------------------------------------------------------------------

which users are in which mailbox database on Exchange

Get-Mailbox | Sort database, name | Format-Table name, database

 This one will give you all mailboxes on all databases listed in order

get-mailbox | sort database, name | format-table name, database

This one will give you all mailboxes on a specific database,

Get-MailboxDatabase *name_of_database* | Get-mailbox

This one will give you all the mailboxes sorted by size, largest first, in a given database or all databases and export to a text file on the C drive,

Get-MailboxDatabase "<insert database name or don’t enter one for all DB’s>" | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount (optional | Select –first 25) >> C:\*name_of_file*.txt.

-------------------------------------------------------------------------------


To get a count of all mailboxes in the Exchange 2010 organization use the following command:

(Get-Mailbox).count



Note that if you know your organization has over 1000 mailboxes you need to make sure that the result size of the command output is not limited.

(Get-Mailbox -resultsize unlimited).count



Next, we can get a count of mailboxes per Exchange 2010 mailbox server.

Get-Mailbox | Group-Object -Property:ServerName | Select-Object name,count

We can also get a count of mailboxes per database in the Exchange organization.

Get-Mailbox | Group-Object -Property:Database | Select-Object name,count

--------------------------------------------------------------------------------------------------------------------

To get a count of all mailboxes in the Exchange 2010 organization use the following command:

(Get-Mailbox).count



Note that if you know your organization has over 1000 mailboxes you need to make sure that the result size of the command output is not limited.

(Get-Mailbox -resultsize unlimited).count



Next, we can get a count of mailboxes per Exchange 2010 mailbox server.

Get-Mailbox | Group-Object -Property:ServerName | Select-Object name,count

We can also get a count of mailboxes per database in the Exchange organization.

Get-Mailbox | Group-Object -Property:Database | Select-Object name,count

----------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment