Friday, August 7, 2015

First Glance on Exchange 2016 (Part 1)

Hi folks,

As you know our beloved Microsoft is about to produce Exchange Server 2016 in the Q4 this year. Meanwhile since 22 July we have Exchange 2016 Preview available for free to download with the accompanying documentation which can be find in TechNet Library.

As some of you may know architecture of Exchange 2016 has been changed as compared to 2013. CAS role has been removed and instead CAS service is now available on the Mailbox role. It is responsible for authentication, proxy, and limited redirection services, and the HTTP, POP, IMAP, and SMTP client access protocols. So it appears that Exchange 2016 Mailbox server is multi-role Exchange 2013 box. Of course there are a lot of improvements into storage and namely to DAGs.



Overall technical requirements are not much different of those that were in Exchange 2013, even though they are not 100% the same.

So I have decided to build the lab in my virtual environment at home. I have deployed 1 domain controller (Windows 2012 forest mode, as minimum Windows 2008 is now are required) and 2 Exchange servers.

Installation, doesn't differ much from what we had in Exchange 2013.

So first we start with installation of the Exchange 2016 prereqs in the following order:

1. Windows Features. You can find the code for installing necessary Windows 2012 R2 components as well as other prereqs on this page.



2. .Net Framework 4.5.2



3. UCMA 4.0



After this we need to prepare Active Directory for Exchange deployment. Of course when you install first server of the new Exchange release (whether the main version, Service Pack or Cumulative Update) AD should be extended to support new object types and attributes. Of course installation program can do it on your behalf which is good for lab but not very good in most of the production environments.

There are 3 commands to prepare AD in a more controlled fashion (commands are pretty obvious so I won't explain you what each of them does):

setup.exe /prepareSchema /IAcceptExchangeServerLicenseTerms

setup.exe /PrepareAD /OrganizationName:EXCHORGNAME /IAcceptExchangeServerLicenseTerms

setup.exe /PrepareDomain /IAcceptExchangeServerLicenseTerms




If you want to make sure that AD prep has been successful you can refer to this my previous blog post. Or alternatively you can launch ADSIEdit  and see that container for Exchange organization has been created with all the necessary sub-containers.



After AD is prepared and all prereqs are in place we are ready to install our first Exchange 2016 server. Again installation methods didn't change from the last versions:

If you use command line unattended method you can use command like this one:

setup.exe /mode:Install /Roles:Mailbox /IAcceptExchangeServerLicenseTerms



Alternatively you can use good old installation method as below. I believe no explanations are needed here.













After installation is over you can check if all Exchange services are running by using Test-ServiceHealth cmdlet



I will continue posting about this new version as I play in my lab and explore new features.

To be continued...

Reporting Quota Status of the Mailboxes in Multiple Databases

Hi folks,

Just wanted to share with you about my recent adventure. I needed to plan .

This code will perfectly work for the scenario when you maintain standard naming conventions for your mailbox databases. This allows you to use wild card when you want to extract information about mailboxes in more than one database, in case you have standard conventions for regions or datacentres.

It will run quickly enough against mailboxes hosted within these databases.

Get-MailboxDatabase DB* |sort Name |Get-MailboxStatistics |Select DisplayName,StorageLimitStatus,TotalItemSize |Export-Csv MbxQuotaStatus.csv -Encoding Unicode

When report has generated it opens in Excel as the text file delimited with commas. To make Excel-like view for further analysis I have launched Excel and clicked Open and browsed for the file.

When file as opened i was asked about the file format I have selected Delimited and also requested to selected to start import at row 2 to avoid rubbish like #TYPE Selected.Microsoft.Exchange.Data.Mapi.MailboxStatistics to be in the file.


After clicking Next I have been presented with the option to select delimiter which has been comma in  my case.



After clicking Next on this and next page I got a nice report as this.



Enjoy.

Thursday, August 6, 2015

Retrieving Information about AD Related Settings of Exchange Servers

Hi folks!

Just wanted to share with you a quick way to retrieve information on how your Exchange servers. You can do it easily by executing Get-ExchangeServer cmdlet.

Please note that if you have static domain controllers or global catalogs hardcoded on your Exchange server you will need to use -Status parameter. In addition to get readable values in your CSV file (if you need to create a report you will need to configure expression like this @{N="Static GC";E={$_.StaticGlobalCatalogs}}.

So the sample script for all Exchange 2010 and later serves will be like this:

Get-ExchangeServer -Status|sort Name |select Name,Site,@{N="Static GC";E={$_.StaticGlobalCatalogs}} |Export-Csv D:\Scripts\Exchange-Sites-GC.csv

Enjoy.

Script for Installing AD Forest In Windows 2012 R2

Hi Folks,

As you know DCPROMO is gone in Windows 2012 and later as the main DC promotion tool. Now Server Manager or PowerShell should be used to promoted Windows 2012 servers into domain controllers. You can read more about them here.

The appropriate PowerShell cmdlets are executed whether DC is being promoted from Server Manager tool or when Powershell script is executed directly from prompt. The good thing is that you no more need to create answer file for silent installation as it was with DCPROMO command tool.

In the example below you can see how you can create a new forest without a single mouse click. All you need is to save this code as PS1, replase with your values and execute. As the result you will get brand new forest

Import-module ServerManager
Add-windowsfeature -name AD-Domain-Services,RSAT-AD-Tools,RSAT-ADDS,RSAT-AD-PowerShell,RSAT-AD-AdminCenter,RSAT-ADDS-Tools
Import-module addsdeployment
Install-ADDSForest –SafeModeAdministratorPassword (read-host "DSRM Password" -assecurestring) –DomainName contoso.com –DomainNetBIOSName CONTOSO –DomainMode Win2012 –ForestMode Win2012 –DatabasePath "C:\Windows\NTDS" –SYSVOLPath "C:\Windows\SYSVOL" –LogPath "c:\Windows\NTDS" -InstallDNS –NoRebootOnCompletion

As you can see from screenshots below script will add all the necessary role and feature components after which it will promote a server to a brand new DC for the brand new AD forest (this will include DNS and Global Catalog roles as well).








If you need to promote additional DC in your forest/domain then the following script should be for your help.

Import-module ServerManager
Add-windowsfeature -name AD-Domain-Services,RSAT-AD-Tools,RSAT-ADDS,RSAT-AD-PowerShell,RSAT-AD-AdminCenter,RSAT-ADDS-Tools
Import-module addsdeployment
Install-ADDSDomainController -SafeModeAdministratorPassword (read-host "DSRM Password" -assecurestring) -credential (get-credential) -InstallDNS -domainname contoso.com –DatabasePath "C:\Windows\NTDS" –SYSVOLPath "C:\Windows\SYSVOL" –LogPath "c:\Windows\NTDS" –NoRebootOnCompletion

Please note that  –NoRebootOnCompletion is not necessary and by default when not specified server bounces automatically after DC promotion. I  used it to make my process more controllable and for better visibility in this post. If this parameter is not used server will restart automatically. Otherwise you will get a message as below:



And of course before using these script make sure you adjust them for your particular needs.

I hope this will make AD forest promotion much easier and more enjoyable.

Enjoy.

Friday, July 31, 2015

Nicely Retrieving Calendar Processing Information


Hi folks,

Just wanted to share with you a quick way to check if your meeting rooms accept invitations from the outside of the Exchange organization.

$MBX = Get-Mailbox -RecipientTypeDetails RoomMailbox -ResultSize Unlimited
$MBX |select DisplayName,@{N="External Calendar Processing";E={(Get-calendarprocessing -identity $_.Name).ProcessExternalMeetingMessages}}

Enjoy.

Reporting Mailbox Usage Statistics

Hi folks,

Just wanted to share with you a script I have recently used to extract information about the mailboxes, their size and also dates of the newest and the oldest item. It can be extremely useful for planning activities when you're trying to identify the size of the mailboxes in your environment to plan potential migration traffic and also storage for Exchange or Office 365 migration activities.

I want to thank authors of this thread for giving me this hint.

As the result I have got something as below:


#This script can be run against a single mailbox, group of mailboxes or all mailboxes. All you need is to replace value for $mbx variable
#if you run it against a single mailbox set $mbx to something like $mbxs = Get-Mailbox -Identity john.smith
#if you run it against mailboxes in a certain region filter it by domain, like Get-Mailbox -Filter {EmailAddresses -Like "*contoso.com*"}
#If you run it against all mailboxse just use $mbxs = Get-Mailbox -ResultSizeUnlimited


$mbxs = Get-Mailbox -Filter {EmailAddresses -Like "*contoso.com*"} -ResultSize Unlimited
$mbxs | %{
    $newest = $oldest = $null
    $mb = $_
    $mb | Get-MailboxFolderStatistics -IncludeOldestAndNewestItems | %{
        if($_.NewestItemReceivedDate -and (!$newest -or $newest -lt $_.NewestItemReceivedDate.tolocaltime())){
            $newest = $_.NewestItemReceivedDate.tolocaltime()}
        if($_.OldestItemReceivedDate -and (!$oldest -or $oldest -gt $_.OldestItemReceivedDate.tolocaltime())){
                $oldest = $_.OldestItemReceivedDate.tolocaltime()}
    }
    $stat = $mb | Get-MailboxStatistics
    New-Object -TypeName psobject -Property @{
        DisplayName = $mb.displayname
        SMTPAddress = $mb.PrimarySMTPAddress.tostring()
        TotalItemSize = $stat.TotalItemSize
        TotalItems = $stat.itemcount
        RetentionPolicy = $mb.retentionpolicy
        NewestItem = $newest
        OldestItem = $oldest    
    }
} | Select-Object -Property DisplayName, SMTPAddress, TotalItems, TotalItemSize, RetentionPolicy, NewestItem, OldestItem |
    Export-Csv "D:\Scripts\MbxStats.csv" -NoTypeInformation

It will be output into the nice and readable Excel file like this:



Enjoy

Who Has Send-As Permissions to Mailbox

Hi folks,

Here is a quick way to retrieve who has Send-As permission to a mailbox in Exchange server environment.

Get-Mailbox user1@contoso.com |Get-ADPermission|Where-Object {$_.extendedrights -like "*send*"} |select Identity,User,@{N="Access Rights";E={$_.AccessRights}}|Export-Csv Send-As.csv

We end up with the nice Excel spreadsheet as below:




Enjoy!