Tuesday, November 11, 2014

Quick Retrieving of Windows Updates installed in Exchange Environment

Hi folks,

I would love to share with you a quick and easy way to retrieve Windows updates installed in your Exchange 2010/2013 estate.

Instead of logging on locally to each server all you need is to execute Get-WmiObject -Class "win32_quickfixengineering" command against each server.

In my case I have simply added to the pipe all the Exchange servers that are domain members (usually Edge Transport servers are not added to the domain and the command should be executed against them separately). So if you don't run Edge servers in your environment there's no need to

So my command to retrieve this information looks like this (please note that I used Sort command to arrange patches based on server name and date of the installation)

Get-ExchangeServer | Where-Object {$_.ServerRole -ne "Edge"} |foreach {Get-WmiObject -Class "win32_quickfixengineering" -ComputerName $_.Name} |sort Source,InstalledOn

Optionally you can export the information to CSV file (screenshots below) to get more comprehensive report or use Select-Object command to limit it to certain parameters you're interested in.





Enjoy


Tuesday, October 21, 2014

Deleting Items from Mailbox Dumpster

Hi folks,

Let me share with you about another task that you usually don't do on day to day basis.

As an intro I would love to share with you link to this article which explains what is Dumpster 2.0 is and how it is used in Exchange 2010 and 2013 environments. In couple words, after being deleted messages are being stored in dumpster for further restore and legal purposes.

Every now and then we need to delete items from dumpster to free up space used by them. Please note that this will create white space in the mailbox which can be reused for the new messages that arrive to the mailbox.

To check how much deleted messages are stored in mailbox you can run command like this:

Get-MailboxStatistics "Farhad Mahmudov" |select *size*

or even a nicer one like this

Get-MailboxStatistics "Farhad Mahmudov" |select DisplayName,TotalDeletedItemSize,TotalItemSize

In any case you will have information of how much data you have in mailbox altogether as well as deleted items size:



To remove data from dumpster you need to run the Search-Mailbox command with parameters as follows and confirm when prompted:

Search-Mailbox -Identity "Farhad Mahmudov" -SearchDumpsterOnly -DeleteContent

This may take some time depending on how much data you have in Recovered Items folder (dumpster) and give you output on how much data has been removed from the mailbox.



Optionally, you can double check this by running Get-MailboxStatistics command.

Enjoy.

Friday, October 10, 2014

Reporting ActiveSync Devices' Details

Hi folks,

Looks that I haven't posted on my blog for the good couple months, as I've been off for holiday and then spent all my weekdays evening preparing for certification exams.

This post will be quite short. As IOS 8 became available and many people started updating their iPhone and iPad devices, I have been requested by the client of mine to extract information about the information about the devices that are using ActiveSync to connect to their Exchange mailboxes.

The command Get-ActiveSyncDevice allows you to extract information about ActiveSync devices that are connected to your Exchange 2010 or 2013 environment. Depending of what you need in your report you can select different attributes of the retrieved ActiveSync devices.

In my case final code was pretty easy and straightforward and produced CSV file with the report which went to the CTO's desk.

Get-ActiveSyncDevice -ResultSize unlimited |select UserDisplayName,DeviceType,DeviceId,DeviceOS,DeviceModel,Frie
ndlyName |Export-Csv D:\Software\EAS_Device_Report.csv

And the report looks like this:



Hope it helps you as it helped me.

Thursday, July 31, 2014

Who Shutdown Your Exchange Servers


Hi folks,

Let me share with you a small script that will help to identify when and by whom Exchange servers have been restarted. Since it queries Event Log it can be used for all the other servers, no matter what role they are running.

What the script does checking System log of your Windows box for event 1074 and then you can output details that you need to CSV file.



In my case I'm running this script against Exchange servers which are the part of AD domain (which excludes Edge Transport servers). You can run it on Edge servers locally and therefore script text will slightly change (with no need to create variable that has all Exchange servers.

Therefore my text looks like this:

$ExServers=Get-ExchangeServer | Where-Object {$_.ServerRole -ne "Edge"}

$ExServers | foreach {Get-EventLog -ComputerName $_.Name -LogName system |Where-Object {$_.EventID -eq "1074"}} |Select EventID,MachineName,Message,TimeGenerated,TimeWritten,UserName |Export-Csv D:\Software\Event-1074.csv

Enjoy, hope it helps you as it did help me.

Wednesday, July 30, 2014

Dealing with Failing Exchange 2010 Multi-Role Server Installation

 
Hi folks,

I would love to share about one more adventure I recently had with one of my clients' messaging platforms. I needed to install additional CAS/HUB servers in order to support hybrid deployment with Office 365 and further migration into the cloud.

What can be simpler that that. I have got 3 VMs running Windows 2008 R2 on which I have installed all the prereqs as listed here.

However, when running step of installing and configuring multi-role server my installation would stumble and fail at the point of installing Exchange management tools. with the error as below:

 Exchange Management Tools                                 FAILED
     The following error was generated when "$error.Clear();  Set-WERRegistryMarkers; " was run: "Provisioning layer initialization failed: '"Scripting Agent initialization failed: "File is not found: 'c:\Program Files\Microsoft\Exchange Server\V14\Bin\CmdletExtensionAgents\ScriptingAgentConfig.xml'.""'".



The investigation lead me that the cause of the problem is Cmdlet Extension Agents which requires ScriptingAgentConfig.xml to be present on  a server. And since it's a brand new server of course this file is not there.

As a result some of Exchange files are installed on the affected server, however server roles are not configured and no changes in Active Directory are done.

To resolve this problem first you will need to run on one of the Exchange 2010 servers in your organization the following command:

Disable-CmdletExtensionAgent -Identity "Scripting Agent"



This will temporarily disable you from running modified or extended Exchange 2010 cmdlets, but it will allow you to successfully complete Exchange 2010 installation.

After disabling Scripting Agent you can re-run Exchange 2010 installation. 

Optionally, you can uninstall failed Exchange 2010 installation as did because I prefer nice and clean installations. In my case I had to run installation couple times as one of uninstallations failed with the error like this one (which is result of a lame installation):


This uninstallation simply removes the files installed earlier.

After that you can run Exchange installation again using your favorite installation method. Just in case details about Exchange installation can be found here for 2013 and here for 2010.

In my case I ran setup.com /m:Install /r:CA,HT /InstallWindowsComponents to install Exchange 2010 CAS/HUB server with Windows prereqs and installation went successfully.

After the installation is over you will need to rename file named ScriptingAgentConfig.xml.sample which is installed into C:\Program Files\Microsoft\Exchange Server\V14\Bin\CmdletExtensionAgents. Otherwise Exchange tools will fail starting pointing to the similar error as installation.


You simply right-click the file and remove sample from its name, so it becomes XML file.



Finally,  after the installation of all my multi-role servers was over I have enabled Scripting agent back by running

Enable-CmdletExtensionAgent -Identity "Scripting Agent"




I hope this will be of a great use to you.


Tuesday, July 29, 2014

Slipstreaming Rollup Updates Into Exchange 2010 Installation

Hi folks,

If you are working on a large deployment of Exchange 2010 servers in addition to the latest service pack (SP) you will also need to have latest Rollup Update (RU) installed. Please note that Service Pack installations are the separate builds and there's no need to integrate them into Exchange installation files. So for example to install SP3 you simply need to extract files and run installation running setup.exe (for GUI) or setup.com (for unattended).

Back to RU now. Slipstreaming process is fairly easy. All you need to do is to place MSP file for the latest RU into the Update subfolder of your Exchange 2010 installation folders.



After that you run installation command and wait for the end of installation.

And here you go! In my case I have installed Exchange 2010 SP3 with RU5 without any additional effort.

And when you check Exchange version using Exchange Management Console (for some reason in 2010 PowerShell doesn't reveal RU version information) you are getting 14.03.0181.006 which corresponds to RU5 for SP3 (as it is my scenario). This may differ in yours.


Alternatively, you can find it in Windows Updates applet of Control Panel by running see Installed Updates.



Please note that you will need to keep this file structure available to you for any installs, uninstalls or updates of your Exchange build on a server you installed it at.

Finally, in Exchange 2013 the servicing model has been changed and you now have Cumulative Updates (CU) published every quarter and SP published every year. Every CU and SP is now a separate build, so they can be installed using Setup /m:Install on the new servers and Setup /m:Upgrade on the new servers.

Enjoy.

Friday, July 11, 2014

Reporting Mount Points for Mailbox Servers

Hi Folks,

Recently I had one more adventure.

I extremely love my customers, especially those who have a good standardization and conventions in their infrastructure. One customer of mine had pretty strict requirements for size of LUNs for database files and transaction logs.

However 2 things happened. Once their backup had got broken which as you know would result of transaction logs not being truncated and disk space usage grow presenting the threat of dismounting of database. This resulted into extending size of LUNs used by transaction logs and further discrepancy in disk size.

So my task was to determine which LUNs don't have standard size so that their size can be squeezed back to a standard one. LUNs were presented to mailbox servers as mount points.

In order to discover their size I decided that I generate a script that would report information about mount points and generate a nice CSV files that can be later processed by Microsoft Excel.

My greatest thanks to the author of  this article as I used it as basis for my script.

First I defined variables so that data is output into CSV in gigabytes instead of bytes. And after that I defined a variable for all mount points which then I have output into CSV file.

And I ended up with script that exports information about absolutely all mount points that I have across my client's Exchange estate:

$TotalGB = @{Name="Capacity(GB)";expression={[math]::round(($_.Capacity/ 1073741824),2)}}
$FreeGB = @{Name="FreeSpace(GB)";expression={[math]::round(($_.FreeSpace / 1073741824),2)}}
$FreePerc = @{Name="Free(%)";expression={[math]::round(((($_.FreeSpace / 1073741824)/($_.Capacity / 1073741824)) * 100),0)}}

$MPoints = Get-MailboxServer |foreach {Get-WmiObject -computer $_.Name win32_volume | Where-object {$_.DriveLetter -eq $null}} 
$Mpoints |Select SystemName,Name, Label, $TotalGB, $FreeGB, $FreePerc |Export-Csv D:\Scripts\Mount_Points_All.csv

I have also done some tweak to make output of a particular mount points I was interested in. I needed information of all mount points which are larger than 100 GB and smaller than 855 GB, so I ended up with the filter {$_.Capacity -gt  107374182400 -and $_.Capacity -lt  918049259520} which is calculated by converting GB into bytes, so the code looked like:

$MPoints |Where-object {$_.Capacity -gt  107374182400 -and $_.Capacity -lt  918049259520} | Select SystemName,Name, Label, $TotalGB, $FreeGB, $FreePerc| sort-object SystemName,Label | Export-Csv D:\Scripts\MountPoints_Oversized.csv

And of course you can come up with different other filters that will allow you to extract the exact information you may need.

In my case I have ended up with the nice Excel file as below:



Enjoy.