Friday 27 July 2012

shared mailbox

Create and configure a shared mailbox with PowerShell

After you create a shared mailbox, you have to assign permissions to all users who require access to the shared mailbox. Users can't sign in to the shared mailbox. They have to sign in to their own mailbox and then open the shared mailbox to which they've been assigned permissions.
Here's how to use PowerShell to create and configure a shared mailbox for the Corporate Printing Services department at Contoso Corporation.
  1. Create a shared mailbox   To create the shared mailbox for Corporate Printing Services, run one of the following commands:
New-Mailbox -Name "Corporate Printing Services" -Alias corpprint -Shared

Set-Mailbox corpprint -ProhibitSendReceiveQuota 5GB -ProhibitSendQuota 4.75GB -IssueWarningQuota 4.5GB

New-Mailbox -Name "Corporate Printing Services" -Alias corpprint -Shared

The new shared mailbox is displayed in the Mailboxes list in the Exchange Control Panel.

    2.   Create a security group for the users who need access to the shared mailbox   In the  Exchange  Control Panel, create a security group for the staff who need access to the shared mailbox for Corporate Printing Services.

a. Select My Organization > Users & Groups > Distribution Groups > New.
b. Specify a display name, alias, and e-mail address. In this example, we'll use Printing Services Staff, corpprintDG, and corpprintDG@contoso.com.

c. Select the Make this group a security group check box.

d. In the Ownership section, click Add to add an owner, if necessary.
e. In the Membership section, click Add.

f. In the Select Members page, select the users you want to add. When you are finished, click OK.
g. On the New Group page, click Save.

Note   After you create a security group, the membership is closed. When membership is closed, only group owners can add members to the security group, or owners have to approve requests to join the group. Additionally, only group owners can remove members from the security group.
  
   3.    Assign the security group the FullAccess permission to access the shared mailbox   To enable members of the Printing Services Staff security group to open the shared mailbox, read e-mail, and use the calendar, run the following command:

Add-MailboxPermission "Corporate Printing Services" -User corpprintDG -AccessRights FullAccess
     4.    Assign the security group the SendAs permission to the shared mailbox   To enable members of the Printing Services Staff security group to send e-mail from the shared mailbox, run the following command:
 
Add-RecipientPermission "Corporate Printing Services" -Trustee corpprintDG -AccessRights SendAs

Wednesday 25 July 2012

Outlook Anywhere

What is Outlook Anywhere?

This is a system that lets you connect Microsoft Outlook to to your Exchange server over the web, this means you can connect to to your email, calendaring and tasks etc, without the need for a VPN connection.

Outlook Anywhere wizard on the Exchange Server 2010 Client Access server to allow users to connect to their Exchange mailbox from the Internet. Outlook Anywhere eliminates the need for users in remote offices or mobile users to use a virtual private network (VPN) to connect to their Exchange servers.
Outlook Anywhere will be enabled on your Client Access server after a configuration period of approximately 15 minutes. To verify that Outlook Anywhere has been enabled, check the application event log on the Client Access server

The Windows RPC over HTTP Proxy component, which Outlook Anywhere clients use to connect, wraps remote procedure calls (RPCs) with an HTTP layer. This allows traffic to traverse network firewalls without requiring RPC ports to be opened. In Exchange 2010, as in Exchange 2007, it's easy to deploy and manage this feature. To deploy Outlook Anywhere in your Exchange 2010 messaging environment, you need to enable Outlook Anywhere on at least one Client Access server using the Enable Outlook Anywhere wizard in the Exchange Management Console

 Install a valid Secure Sockets Layer (SSL) certificate from a certification authority (CA) that the client trusts.
Install the Microsoft Windows RPC over HTTP Proxy component if it wasn't already installed by default in Windows Server 2008. For detailed steps, see Install the Windows RPC Over HTTP Proxy Component.
Enable Outlook Anywhere on the Client Access server.

Step 1 Configure Exchange

  1. In the console tree, navigate to Server Configuration > Client Access.
  2. In the action pane, click Enable Outlook Anywhere.
  3. In the Enable Outlook Anywhere wizard, type the external host name or URL for your organization in the box under External host name.
    This is the URL, for example site.contoso.com, that users will use to connect to the Exchange server by using Outlook Anywhere.
  4. Enable-OutlookAnywhere -Server 'Exch1' -ExternalHostname 'site.contoso.org' -DefaultAuthenticationMethod 'Basic' -SSLOffloading $false
    
  5. Enable-OutlookAnywhere -Server:Server01 -ExternalHostname:mail.contoso.com -ClientAuthenticationMethod:Ntlm -SSLOffloading:$true

Availability service

The Availability service retrieves free/busy information directly from the target mailbox for users on Exchange 2010 and Exchange 2007 and can be configured to retrieve free/busy information for users on earlier versions of Exchange. For topologies that have Exchange 2007 or Exchange 2010 mailboxes in which all clients are running Outlook 2007, the Availability service is used to retrieve free/busy information.
Bb232134.note(en-us,EXCHG.141).gifNote:
If you have Outlook 2007 clients running on Exchange Server 2003 mailboxes, Outlook 2007 will use public folders to retrieve free/busy information.
Outlook 2007 uses the Exchange Server 2010 Autodiscover service to obtain the URL of the Availability service. For more information about the Autodiscover service, see Managing the Autodiscover Service.
The Availability service is part of the Exchange 2010 programming interface. It is available as a public Web service to allow developers to write third-party tools for integration purposes.
You can use the Exchange Management Shell to configure the Availability service. You can't use the Exchange Management Console to configure the Availability service.
-------------------------------------------------------------------------------------------------------
You must create a test account before you can diagnose Availability service issues using the Test-OutlookWebServices cmdlet. To create the test mailbox, log on to the Exchange Server 2007 or Exchange 2010 Mailbox server

This example tests access to the Availability service for user User1@Contoso.com.
 
Test-OutlookWebServices -Identity: User1@Contoso.com
This example tests user access to the Availability service on the Client Access server ClientAccessServer01.
 
Test-OutlookWebServices -ClientAccessServer ClientAccessServer01
 
This example tests Availability service connectivity between users in two different Active Directory sites.
 
Test-OutlookWebServices -Identity User1@Site1.Contoso.com -TargetAddress User2@Site2.Fabrikam.com
  --------------------------------------------------------------------------------------------------------
This example configures the Availability service for load balancing for a domain named Contoso.com.
 
Set-WebServicesVirtualDirectory -Identity "EWS*" -ExternalUrl "Https:// mail.contoso.com/EWS/Exchange.asmx" -InternalUrl "Https:// mail.contoso.com/EWS/Exchange.asmx"
Aa997237.note(en-us,EXCHG.141).gifNote:
If you have a set of load balanced Client Access servers, you don't have to specify the name of each server when you run this command. You only need to use the name of one of the servers in the set of load balanced servers.
------------------------------------------------------------------------------------------------------------
This example configures the Availability service to retrieve per-user free/busy information on a Client Access server in the target forest.
 
Get-ClientAccessServer | Add-ADPermission -Accessrights Extendedright -Extendedrights "ms-Exch-
EPI-Token-Serialization"  -User "<Remote Forest Domain>\Client Access servers"
This example defines the free/busy access method that the Availability service uses on the local Client Access server in the source forest. The local Client Access server is configured to access free/busy information from the forest ContosoForest.com on a per-user basis. This example uses the service account to retrieve free/busy information.
 
Add-AvailabilityAddressSpace -Forestname ContosoForest.com -AccessMethod PerUserFB -UseServiceAccount:$true
To configure bidirectional cross-forest availability, repeat these steps in the target forest.
---------------------------------------------------------------------------------------------------------
This example configures trusted cross-forest availability with a service account.
 
Get-ClientAccessServer | Add-ADPermission -Accessrights Extendedright -Extendedright "ms-Exch-EPI-Token-Serialization"  -User "<Remote Forest Domain>\Exchange servers"

Tuesday 24 July 2012

Autodiscover

Autodiscover information is stored in a so called SCP or Service Connection Point. You can view this SCP using Active Directory Sites and Services after you have enabled the “View Services Node”
When installing the Client Access Server (Autodiscover is part of this Server Role) the SCP is automatically created in Active Directory and configured with the default values. If you have multiple CAS Servers there will be multiple SCP’s as well.

Get-AutodiscoverVirtualDirectory |FL
Get-AutodiscoverVirtualDirectory | Select name, internalURL, externalURL
Get-ClientAccessServer | fl name, autodiscoversitescope       # to find out the present scopes
Set-ClientAccessServer –identity “Paris CAS Servername”–AutodiscoverSiteScope “Site1, Site2, Site3”

Exchange Server 2010 the properties related to these settings are configured during setup of the Client Access Server when entering the “this is an external facing Client Access Server” option. When you do not select this option, or in Exchange Server 2007 you have to configure these properties manually using the Exchange Management Shell:

Changing these properties doesn’t have the desired effect. For changing the internalURL settings you have to modify the Client Access Server properties. Enter the following command in an Exchange Management Shell:

Get-ClientAccessServer –Identity X2007SRV | Set-ClientAccessServer –AutodiscoverServiceInternalUrihttps://autodiscover.inframan.nl/autodiscover/autodiscover.xml

Set-OWAVirtualDirectory –Identity 2010CASHUB02\OWA (default web site) -ExternalURL https://webmail.exchange14.nl/OWA

Set-OABVirtualDirectory –Identity 2010CASHUB02\OAB (default web site) -ExternalURL https://webmail.exchange14.nl/OAB

Set-WebServicesVirtualDirectory –Identity 2010CASUB02\EWS (default web site) -ExternalURL https://webmail.exchange14.nl/ews/exchange.asmx

Set-ActiveSyncVirtualDirectory –Identity 2010CASHUB02\Microsoft-Server-ActiveSync (default web site) -ExternalURL https://webmail.exchange14.nl/Microsoft-Server-ActiveSync

This setting is only valid for Exchange Server 2010:

Set-ECPVirtualDirectory –Identity 2010CASHUB02\ECP (default web site) -ExternalURL https://webmail.exchange14.nl/ECP

The last step is to configure the external DNS. Both the webmail hostname as well as the Autodiscover hostname need to point to the external facing Client Access Server.
When you start up Outlook 2007 or Outlook 2010 you can automatically configure your profile, just by entering your e-mail address and password. When Outlook is configured it can take some time before Outlook is synchronized, but after some time you should be all set. If all goes well you should be able to set your out-of-office settings and check other mailboxes free/busy information.

Commands:
  • Set-ClientAccessServer -Identity CASServer -AutoDiscoverServiceInternalUri https://webmail.shudnow.localS/Autodiscover/Autodiscover.xml
  • Set-WebServicesVirtualDirectory -Identity “CASServer\EWS (Default Web Site)” -InternalURL https://webmail.shudnow.local/EWS/Exchange.asmx -ExternalURL https://webmail.shudnow.net/EWS/Exchange.asmx -BasicAuthentication:$true
  • Set-OABVirtualDirectory -Identity “CASServer\OAB (Default Web Site)” -InternalURL https://webmail.shudnow.local/OAB -ExternalURL webmail.shudnow.net/OAB -RequireSSL:$true
  • Enable-OutlookAnywhere -Server CASServer -ExternalHostname “webmail.shudnow.net” -ClientAuthenticationMethod “Basic” -SSLOffloading:$False
  • Set-ActiveSyncVirtualDirectory -Identity “CASServer\Microsoft-Server-ActiveSync (Default Web Site)” -ExternalURL https://webmail.shudnow.net/Microsoft-Server-Activesync
  • Set-UMVirtualDirectory -Identity “CASServer\UnifiedMessaging (Default Web Site)” -InternalURL https://webmail.shudnow.local/UnifiedMessaging/Service.asmx -ExternalURL https://webmail.shudnow.net/UnifiedMessaging/Service.asmx -BasicAuthentication:$true

CAS Array

And what role does the CAS Array play in the Autodiscover story? The CAS Array is implemented when you have multiple Client Access Servers in a load balanced scenario. Outlook clients connect to a Client Access Server instead of a Mailbox Server for retrieving Mailbox information. This is achieved using the RPC protocol and not using the HTTPS protocol. Think about Outlook 2003 which doesn’t use HTTPS at all. The CAS Array is also used as a ‘backlink’ from the Mailbox Databases to the Client Access Servers. Mailbox Databases have a RPCClientAccessServer property which links a Mailbox Database to a CAS Server. This is also based on the RPC protocol.
The first step is to create a NLB cluster on your Client Access Server and give the cluster a name, for example nlb.labs.local. If you are using Client Access Servers running on Hyper-V (or VMWare) you have to be aware of the MAC address issue. Hyper-V has a range of MAC addresses being used by Virtual Machine. When you create an NLB cluster a random MAC address for the NLB address is generated, and this MAC address is not recognized by the Hyper-V Servers. More information on how to configure this can be found in Microsoft knowledge base article 953828.
Now you can add the CAS Array to the Exchange configuration, and the only option is to use the Exchange Management Shell. Enter the following command:

New-ClientAccessArray -FQDN webmail.inframan.nl -Name CAS_Arrary

The CAS Array will be added to the Exchange configuration, and it Fully Qualified Domain Name is “webmail.inframan.nl”.
Your Outlook clients can now use “webmail.inframan.nl” as the Exchange Server using RPC.
Newly created Mailbox Databases will use the CAS Array as the RPC Proxy, but existing Mailbox Database will use the individual Client Access Servers as the RPC Proxy. To change the –RPCClientAccessServer property on all Mailbox Database in one time, open the Exchange Management

Shell and enter the following command:
Get-MailboxDatabase | Set-MailboxDatabase –RPCClientAccessServer “webmail.inframan.nl”

Monday 16 July 2012

PowerSell Command(Exchange2010)

Get-Mailbox -ResultSize Unlimited |  select DisplayName, Alias, Database, PrimarySmtpAddress,@{name=’IssuewarningQuota’;expression={if ($_.IssueWarningQuota -match “UNLIMITED”) {“-1″} else {$_.IssueWarningQuota.value.tomb() }}},@{name=’ProhibitSendQuota’;expression={if ($_.ProhibitSendQuota -match “UNLIMITED”) {“-1″} else {$_.ProhibitSendQuota.value.tomb() }}},@{name=’ProhibitSendReceiveQuota’;expression={if ($_.ProhibitSendReceiveQuota -match “UNLIMITED”) {“-1″} else {$_.ProhibitSendReceiveQuota.value.tomb() }}},WhenCreated  |export-csv C:\stats.csv
“DisplayName,Alias,MailboxSizeMB,ItemCount,PrimarysmtpAddress,IssueWarningQuotaMB,ProhibitSendQuotaMB,ProhibitSendReceiveQuotaMB,DatabaseName,CreationDate,LastLogonTime,LastLogoffTime,isActive” | out-file C:\MailstatsResult.csv

Get-MailboxStatistics -server "server" | Sort -Property TotalItemsize | Format-Table DisplayName, LastLoggedOnUserAccount, ItemCount, @{expression={$_.totalitemsize.value.ToMB()};label=”Size(MB)”}, LastLogonTime, LastLogoffTime | Export-CSV c:\test13.csv

Get-Mailbox -ResultSize Unlimited |  select DisplayName, Alias, Database, PrimarySmtpAddress

Get-MailboxStatistics -server "server"  |  select DisplayName, Alias, Database, PrimarySmtpAddress

Get-Mailbox -ResultSize Unlimited |  select DisplayName,Alias,MailboxSizeMB,ItemCount,PrimarysmtpAddress,IssueWarningQuotaMB

Get-Mailbox | Get-MailboxFolderStatistics | Select Identity,FolderPath,FolderSize,ItemsInFolder | Sort-Object ItemsInFolder | fl

Add-MailboxPermission testmbx -AccessRights FullAccess -user jaredz
Set-Mailbox testmbx -GrantSendOnBehalfTo jaredz
Add-ADPermission testmbx -ExtendedRights Send-As -user jaredz
Add-ADPermission user -User “DomainB\User” -Extendedrights “Send As”
“Set-Mailbox “USER” -GrantSendOnBehalfTo “DomainB\User”
Get-Globaladdresslist | update-Globaladdresslist
Get-Addresslist | Update-Addresslist
Add-MailboxFolderPermission -Identity marry:\Calendar -User harry -AccessRights Reviewer
Get-MailboxFolderStatistics -Identity marry
Get-MailboxFolderPermission -Identity marry:\Calendar
Get-MailboxFolderStatistics -Identity marry -FolderScope Calendar | Select-Object -First 1).Name
Get-MailboxFolderPermission -Identity marry:\Calendar
Set-MailboxFolderPermission -Identity marry:\Calendar -User harry -AccessRights Owner
Get-MailboxFolderPermission -Identity marry:\Calendar
Set-MailboxFolderPermission -Identity marry:\inbox -User harry -AccessRights Owner
Set-MailboxFolderPermission -Identity marry:\task -User harry -AccessRights Owner
Set-MailboxFolderPermission -Identity marry -User harry -AccessRights Owner
Update-Calendarpermission -identity marry -User harry -Permission ReadItems
Set-MailboxFolderPermission -Identity LasseP:\Calendar -User Eva -AccessRights Owner
Add-MailboxFolderPermission -Identity LasseP:\Calendar -User Eva -AccessRights Reviewer
Get-MailboxFolderPermission -Identity LasseP:\Calendar
Get-MailboxStatistics -server serverhere | Where-Object {$_.DisplayName -like "*MailboxUserName*"} | Format-Table DisplayName,ItemCount,TotalItemSize
Get-Mailbox -Database "Db3" -ResultSize Unlimited |Set-Mailbox -RecipientLimits 5
new-mailboxdatabase -Server 'ggncloud' -Name 'db3' -EdbFilePath 'E:\Exch2010-DBs\<DATABASE NAME>\db3.edb' -LogFolderPath 'E:\Exch2010-Logs\db3'
Mount-Database -Identity "db3"
Set-MailboxDatabase -ProhibitSendReceiveQuota '45Mb' -ProhibitSendQuota '40Mb' -IssueWarningQuota '35Mb' -RetainDeletedItemsUntilBackup $true -Identity "db3"
Set-MailboxDatabase -OfflineAddressBook '\Default Offline Address Book' -Identity "db3"
New-GlobalAddressList -Name "gal" -RecipientFilter {(MemberOfGroup -eq 'cn=<GROUP NAME>,OU=Exchange Groups,DC=ggncloud,DC=internal')}
Update-GlobalAddressList -Identity "gal"
Add-ADPermission -Identity $dngal -User "gal" -AccessRights extendedright -ExtendedRights "open address list" -Deny:$True
get-mailbox -ResultSize Unlimited
get-powersellvirtualdirectory
get-ActiveSyncMailboxPolicy

Get-MailboxDatabase -Status | Sort-Object name | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace
Get-MailboxDatabase -Identity databasename -Status | Format-Table Name, DatabaseSize, AvailableNewMailboxSpace
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User administrator
Get-MailboxDatabase | Set-MailboxDatabase -OfflineAddressBook "\Default Offline Address Book"
Get-ExchangeServer | FT Name,ServerRole -auto
Get-Mailbox | Get-MailboxStatistics -Server ggncloud | Sort-Object TotalItemSize -Descending | Format-Table DisplayName,ItemCountTotalItemsize
Get-MailboxStatistics "Clayton Kamiya" | FT DisplayName, ItemCount,TotalItemSize
Get-Mailbox | Select Name, ProhibitSendQuota, ProhibitSendReceiveQuota | Export-Csv c:\report.csv
Get-MailboxDatabase -IncludePreExchange2010
ServerManagerCMD -i RPC-over-HTTP-Proxy
Set-OwaVirtualDirectory "ggncloud\owa (Default Web Site)" -ExternalURL $Null
Get-MailboxDatabaseCopyStatus | Format-List Name,Status,LastInspectedLogTime,ContentIndexState
Get-MessageTrackingLog | Format-table EventID,Source,Sender, MessageSubject
Test-WebServicesConnectivity
get-transportserver | fl *Log*
ServerManagerCmd -i Backup-Features
Import-Module Servermanager
Add-WindowsFeature Backup-Features
Servermanagercmd -query
Get-ExCommand *mailbox*
Get-LogonStatistics -Server ggncloud
test-replicationhelth

Thursday 12 July 2012

Managing distribution list in Exchange server 2010

This post contains the information on how to manage distribution list in Exchange server 2010. In exchange server 2010, only the universal distribution or the security group can be mail enabled. No other scopes like Local or Global Distribution Groups are supported in Exchange Server 2010. Below are the distribution groups that can be created
  • Mail enabled Universal Distribution Group
  • Mail enabled universal Security Group
  • Dynamic Distribution Group
Now we will have a look at some of the topics related to managing distribution list in exchange server 2010.
How to create a Distribution Group in Exchange Server 2010
New-DistributionGroup -Name “Name of the Distribution Group” -OrganizationalUnit “DomainName.Com/Exchange Distribution Lists” -SAMAccountName “DIstributionGroupAlias” -Type “Distribution”
How to add owner to a distribution group
Set-Group -Identity “DL Group Name” -ManagedBy “Domain Name\UserName” 
How to add Permission to distribution group for Owner
After adding Managedby user on a distribution group, better to give read and write access permission for Owner
Add-ADPermission -Identity “DL Group Name” -User “DomainName\user” -AccessRights ReadProperty, WriteProperty -Properties ‘Member’ 
How to change the owner of a distribution group
Set-DistributionGroup -Identity “DL Group Name” -ManagedBy “DomainName\NewOwnerUser”
Add-ADPermission -Identity “DL Group Name” -User “DomainName\NewOwnerUser” -AccessRights ReadProperty, WriteProperty -Properties ‘Member’ 
How to add a second or additional owner for a distribution group
Giving read and write access permission at active directory level will allow the other user to function as a co owner for a Distribution Group
Set-DistributionGroup -ManagedBy ‘New Onwer Name’,'Old Owner Name’ -Identity ‘Distribution Group Name’
Add-ADPermission -Identity “DL Group Name” -User “DomainName\SecondOwner” -AccessRights ReadProperty, WriteProperty -Properties ‘Member’ 
How to remove additional owner from a distribution group
Remove-ADPermission -Identity “DL Group Name” -User ” DomainName\SecondOwner ” -AccessRights ReadProperty, WriteProperty -Properties ‘Member’ 
How to rename a Display name and Alias Name for a Distribution Group
Set-DistributionGroup -Identity ‘Distribution Group Name’ -DisplayName ‘Enter New Name’ -Alias “New_Alias” 
How to export the members list from a Distribution Group
Get-DistributionGroupMember -Identity ‘Distribution Group Name” | FL Name 
How to add a New Member to the distribution Group
Add-DistributionGroupMember -Identity “Distribution Group Name” -Member “UserName’ 
How to disable or remove a Distribution Group
Disable-DistributionGroup -Identity “Distribution Group Name”
Remove-DistributionGroup -Identity “Distribution Group Name” 
How to mail enable or mail disable a security group
If we have an active directory security group available and if we want to mail enable that security group, we can use the below shell command and email address will be created for that security group
Enable-DistributionGroup –Identity “DL Display Name”
Disable-DistributionGroup –Identity “DL Display Name” 
How to allow external users to send email to the distribution list
Set-DistributionGroup -Identity ‘Distribution Group Name’ -RequireSenderAuthenticationEnabled $True 
How to allow owners to approve or restrict member to join or to leave a Distribution Group
Set-DistributionGroup -MemberJoinRestriction ‘ApprovalRequired’ -MemberDepartRestriction ‘Closed’ -Identity ‘Distribution Group Name’ 
How to allow only few users to send email to distribution list
Set-DistributionGroup -AcceptMessagesOnlyFromSendersOrMembers ‘User Name 1’,’User Name 2′ -RequireSenderAuthenticationEnabled $True -Identity ‘Distribution Group Name’ 
How to restrict few users to send email to distribution list
Set-DistributionGroup -AcceptMessagesOnlyFromSendersOrMembers “All Users” -RequireSenderAuthenticationEnabled $True -Identity ‘Distribution Group Name’ -RejectMessagesFromSendersOrMembers ‘User Name 1’,’User Name 2′  
How to set a Message Moderator to allow emails and to bypass approval from few users
Set-DistributionGroup -ModerationEnabled $true -ModeratedBy ‘Moderator User Name’ -BypassModerationFromSendersOrMembers ‘User don’t require approval’ -Identity ‘Distribution Group Name’ 
How to hide a distribution group from Gloabll Address List
Set-DistributionGroup -Identity ‘Distribution Group Name’ -HiddenFromAddressListsEnabled $true
How to add additional email address to a distribution list
Set-DistributionGroup -Identity ‘Distribution Group Name’ -EmailAddresses ‘SMTP:existingemailaddress’,'smtp:Newemailaddress’ 
How to create a dynamic distribution list
New-DynamicDistributionGroup -Name “Name of DDG” -Alias “Alias_Name” -IncludedRecipients “MailboxUsers,MailContacts” -OrganizationalUnit “DomainName.com/Users” -ConditionalDepartment “DepartmentName1″,”DepartmentName2″ -RecipientContainer “DomainName.com” 

Mailbox Report in Exchange Server 2010

This information to get a mailbox report for an Exchange Organization. You can change some parameters to get a desired output, if you are facing any issue.
Normal Mailbox Report
To find a mailbox, we will use the below shell command
Get-Mailbox -Identity MailboxName
To get the result of all the mailbox in a Mailbox Database we can use the below shell command
Get-Mailbox -Database “Mailbox Database Name”
To get the result of Mailboxes in a Exchange Server, we can use the below shell command
Get-Mailbox -Server “Exchange Server Name”
To get the above result of all the Mailboxes, we can use Get-Mailbox on a Mailbox Database or a Exchange Server, but if we have more than 1000 mailbox, only the first 1000 mailbox will be displayed. To get all the mailbox, we have to use the below shell command
Get-Mailbox -ResultSize Unlimited
Get-Mailbox -Database “Mailbox Database Name” -ResultSize Unlimited
Get-Mailbox -Server “Exchange Server Name” -ResultSize Unlimited
How to find the entire mailbox and export them to csv file
Get-Mailbox -ResultSize Unlimited | Export-CSV C:\MailboxReport.csv
Above shell command will search for all the mailbox enable accounts in Exchange organization and the output will be passed to a csv file.
How to get the result of only the user mailbox in the exchange Server organization
Get-Mailbox -ResultSize Unlimited -RecipientTypeDetails UserMailbox | Export-CSV C:\MailboxReport.csv
Above shell command will export only the user mailbox in the exchange organization to a csv file. We can change the Recipient Type Details parameter to Room or Shared Mailbox to get the result of only the shared mailbox.
How to find the Mailbox Size Report for a Mailbox
Get-MailboxStatistics will allow an option to get the details on the mailbox size, so we can use the below shell command to find a report for single mailbox
Get-MailboxStatistics -Identity UserName | Ft DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus -Auto
If you want to get the above status report for all the users in a Mailbox Database or Exchange Server
Get-Mailbox -Database “Database Name” -ResultSize Unlimited | Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus | Export-CSV C:\MailboxStatisticsReport.csv
Or to get the result for all the mailboxes in a Server
Get-Mailbox -Server “Server Name” -ResultSize Unlimited | Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus | Sort TotalItemSize -Descending | Export-CSV C:\MailboxStatisticsReport.csv
How can I get the above mailbox size report for only the User mailbox in the Exchange Server Organization and to sort the output via Total Item Size?
Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited |Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus | Sort TotalItemSize -Descending | Export-CSV C:\MailboxStatisticsReport.csv
To find the number of mailboxes on a database or a server or in a exchange server organization
To get the total number of mailboxes in your exchange server organization
(Get-Mailbox -ResultSize Unlimited).Count
If you want to get the mailbox count based on the server
Get-Mailbox -ResultSize Unlimited | Group-Object -Property:Server | Select-Object Count
Or to find the mailboxes on a database per server
Get-Mailbox -ResultSize Unlimited -Server “Server Name” | Group-Object -Property:Database | Select-Object Name, Count
Or you can find mailbox count for all the mailbox database in exchange organization, without specifying the server name
Get-Mailbox -ResultSize Unlimited | Group-Object -Property:Database | Select-Object Name, Count
HTML Report on the Mailbox Report
Below shell command will help you to get the HTML Report for User Mailbox in a Exchange Organization
Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited |Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus | Sort TotalItemSize -Descending | Convertto-HTML -Body “”| Set-Content C:\MailboxReport.htm
Or you can get the HTML Report for all the mailbox using the below shell command
Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Select-Object DisplayName, ServerName, Database, TotalItemSize, ItemCount, StorageLimitStatus | Sort TotalItemSize -Descending | Convertto-HTML -Body “”| Set-Content C:\MailboxReport.htm
--------------------------------------------------------------------------------------------------------------------------

1.To check whether all exchange server related services are running normal?
Test-ServiceHealth or Test-ServiceHealth -Server ServerName
1.To check the Database Mount Status, backup status
Get-MailboxDatabase -Server ServerName -Status | FT Name, Mounted, backupinprogress, lastfullbackup, lastincrementalbackup
1.If High availability configured for Mailbox Server, to check the storage group and mailbox database opy status
Exchange Server 2007 CCR -> Get-StorageGroupCopyStatus -Server ServerName
Exchange Server 2007 SCR -> Get-StorageGroupCopyStatus -Identity MBSRV\SG1 -StandbyMachine Server2
Exchange Server 2010 DAG -> Get-MailboxDatabaseCopyStatus -Server ServerName
1.To check the Mail queue status
Get-Queue -Server ServerName | FL
1.Testing Mailflow whether mail can be successfully sent from and delivered to the system mailbox on a computer that has the Mailbox server role installed
Test-Mailflow Server1 -TargetMailboxServer Server2
Test-Mailflow Server1 -TargetEmailAddress externalemailaddress
Inform if any details are needed.

Tuesday 10 July 2012

Database availability group (DAG) Setup

A database availability group (DAG) is the base component of the high availability and site resilience framework built into Microsoft Exchange Server 2010. A DAG is a group of up to 16 Mailbox servers that hosts a set of databases and provides automatic database-level recovery from failures that affect individual servers or databases.

A DAG is a boundary for mailbox database replication, database and server switchovers, failovers, and an internal Exchange 2010 component called Active Manager. Active Manager, which runs on every server in a DAG, manages switchovers and failovers. For more information about Active Manager, see Understanding Active Manager.

Any server in a DAG can host a copy of a mailbox database from any other server in the DAG. When a server is added to a DAG, it works with the other servers in the DAG to provide automatic recovery from failures that affect mailbox databases, such as a disk failure or server failure.

 You can also create DAG group using the GUI option. But, if you use the Exchange Management Console (EMC) to create the DAG the task will configure the DAG to use Dynamic Host Configuration Protocol (DHCP) to obtain the necessary IP addresses. If you don't want the DAG to use DHCP, you can use the Set-DatabaseAvailabilityGroup cmdlet to configure one or more IP addresses for the DAG & also set the primary OR secondary file share witness.

Setup Steps

·         To create a Database Availability Group (DAG)- Login with appropriate login permissions - Start Exchange Management Shell.
·         Run the shell command
"Get-DatabaseAvailabilityGroup" 
New-DatabaseAvailabilityGroup –Name “DAGName” –WitnessServer “Server Name” –WitnessDirectory “Path” –DatabaseAvailabilityGroupIPAddresses Primary, DR”
o   -Name (DAG Name)
o   -WitnessServer (Prefrebally HubTransport Server – Recommended for  even number cluster)
o   -WitnessDirectory (Directory Path on the HubTransport Server)
o   -DAG IP Addresses (IP addresses from the Primary & DR sites)


Type a name for the DAG. Remember that the DAG must be unique within the Exchange organization and it can consist of up to 15 characters. I will select the server that hosts the Hub Transport and as a witness server, and define C:\DAG1-WS as the witness directory. Click Next to create the DAG.


After DAG is created, run the command "Get-DatabaseAvailabilityGroup DAG1 | FL" to check the default properties of the DAG:
Note that the DAG has no IP addresses configured. It is recommended to assign static address to the DAG. We can run the below command to set IP address to the DAG. Set-DatabaseAvailabilityGroup DAG1 -DatabaseAvailabilityGroupIpAddresses 20.20.0.6


To add members to the DAG group. Open Exchange 2010 Management Console-> Organization Configuration-> Mailbox-> Database Availability Group-> Right Click on the DAG Name and Select Manage Database Availability Group Membership to add additional DAG members.

 Click the Add button in the next screen to add the required DAG members.  Select all the required servers to be part of this DAG group, and then click Manage.  
(Note: The DHCP Client service must be enabled & running on all the DAG members before this step)
Click Finish, Once completed
  • Click Finish, once completed.  Continue same steps until all the remaining members are added.
  • To check the DAG members. Run this “Get-DatabaseAvailabilityGroup” command

-----------------------------------------------------------------------------------------------------------
DAC mode can be turned on by running the shell command below.

Set-DatabaseAvailabilityGroup –identity “dagname” –DatacenterActivationMode DagOnly

http://www.servermigrationlabin.com/2011/07/how-to-work-on-cross-site-failure-in.html