How to Learn User’s Mailbox under Specific Organizational Unit on Exchange Server 2010 PowerShell

Actually this kind of scripts are useful for helpdesk. Because they are required to fix user’s problem and sometimes it is really hard to find a user in EMC if you have big environment

you can write scripts and save them in a folder in Exchange server and they can be used if required. you don’t have write each time same scripts for daily basis jobs.

open exchange server PowerShell and type this command

Get-Mailbox | Where-Object{$_.OrganizationalUnit -like ‘*Sydney*’}

Result;

Name                      Alias                ServerName       ProhibitSendQuota
—-                           —–                ———-               —————–
Administrator         Administrator    Server1                 unlimited

let’s go deeper and complex PowerShell command and to extend this command adding Database option

[PS] C:UsersSonatDesktop>Get-Mailbox | Where-object {($_.Database -eq ‘DB3’) -and ($_.OrganizationalUnit -like ‘*Sydney*’)}

Result;

Name                      Alias                ServerName       ProhibitSendQuota
—-                           —–                ———-               —————–
Administrator         Administrator    Server1                 unlimited

 

and let’s Export this result to CSV  file and when the query is finished, open our result in notepad

[PS] C:UserssonatDesktop>Get-Mailbox | Where-object {($_.Database -eq ‘DB1’) -and ($_.OrganizationalUnit -like ‘*Sydney*’)} | export-Csv c:test1.csv |notepad c:test1.csv

 

one more step is filtering

[PS] C:UserssonatDesktop>Get-Mailbox | Where-object {($_.Database -eq ‘DB1’) -and ($_.OrganizationalUnit -like ‘*Sydney*’)} | Select name, Database, servername | export-Csv c:test1.csv |notepad c:test1.csv

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: