Thursday 14 January 2016

Attachments downloader for Microsoft Exchange as Windows service


   I would like to introduce one my small project. May be at once it will be usefull for some body. At one day I have got task to find solution for downloading attachments in certain mailbox and then put these file to folder in fileserver. Name folder has to depend on processing date. Processing these files from atach greatly affects the business process in company. Therefore this solution has to be reliable and works without any intervation by admins. According to requirements I decide to write application as Windows Service that will be use Exchange Web Services. 
   This project was created in Microsoft Visual Studio 2010 and was tested in Microsoft Exchange 2010 SP1 enviroment.
     After build project you have to install AttachmentsDownloader.exe as service. For this purpose use  AttachmentsDownloader\bin\Release\installService.cmd but before edit it depends on target platform.
      Also the Exchange Web Services (EWS) Managed API 2.0 must be installed on your pc. In project folder AttachmentsDownloader\bin\Release\   located two dll that used in developing and testing enviroment.
      In order to configure custom applicantion settings  change  section  <appSetting> in config AttachmentsDownloader.exe.config


<appSettings>
    <add key="MailServerUrl" value="https://mail.contoso.com/EWS/Exchange.asmx"/>
    <add key="MailBox" value="viktor@contoso.com"/>
    <add key="User" value="viktor"/>
    <add key="Password" value="Pa$$word"/>
    <add key="Domain" value="contoso.com"/>

    <!-- Destination root folder to save files in UNC format -->
    <add key="FolderRoot" value="\\fileserver.contoso.com\d$\tmp\vrf\"/>
 
    <!-- How much emails retrieve to proccess -->
    <add key="ItemsProccesing" value="50" />

    <!--Delay in miliseconds between scan Inbox-->
    <add key="ScanDelay" value="15000" />

    <!-- false - folder format \YYYY\MMYY\DDMMYYYY -->
    <!-- true  - folder format \YYYY\MMYY\DDMMYYYY\SenderEmailDomain -->
    <add key="FolderDestinationNameWithDomain" value="true" />

    <!-- false - leave original file name -->
    <!-- true  - FileName + ddMMyyyy_HHmmss+FileExtesion -->
    <add key="DestinationFileFormatLong" value="true" />

    <add key="ProcessingFileToLog" value="false" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
  </appSettings>
 

   All interesting people can find project on  GitHub

Monday 26 October 2015

Exchange 2010 monitoring database by Zabbix


             In his article I would like share my experience in monitoring  and gathering mailbox databases's statistics in  Exchange 2010 enviroment by Zabbix monitoring system.

            As for me the main problem that I have met was execution time powershell script. Especially loading Exchange 2010 snapin Microsoft.Exchange.Management.PowerShell.E2010 that really increased running time. My first version of solution have used template on Zabbix side and two scripts at agent side, one for discovery purpose other for getting items parameters. Also I set maximum Timeout=30 in Zabbix agent configuration file zabbix_agentd.win.conf .

c:\zabbix\zabbix_agentd.win.conf

### Option: Timeout
#             Spend no more than Timeout seconds on processing
#
# Mandatory: no
# Range: 1-30
# Default:
# Timeout=3
Timeout=30

This solution has worked successfully for one year. But one time powershell scripts started work longer than 30 seconds and as result  Zabbix stopped getting items parameters. I tried to fix it but unfortunately unsuccessful. If you know how to fix it could you share with me I will appreciate it.
     
            So, I have created new solution in short way changing just scripts without touching Zabbix template.  I have wrote  powershell script Get-ExchangeDbStatus.ps1 that generate csv file that contains needed info about mailbox and launch by scheduler every 5 minutes on Exchange server. Two other scripts Get-ExchangeDbDiscovery.ps1 use for discovery function and Get-ExchangeDb.ps1  getting items parameters. I prefer to keep custom user parameters in separate file therefore I configured zabbix_agentd.win.conf  like below.

### Option: Include
#             You may include individual files in the configuration file.
#
# Mandatory: no
# Default:
# Include=
Include=c:\zabbix\zabbix_agentd.userparams.conf

            Configuration file zabbix_agentd.userparams.conf  contains two user parameters.  

#Exchange 2010 MailBox Server Role
UserParameter = exchange.db.discovery[*],powershell.exe  -NoLogo -NoProfile "C:\Zabbix\Get-ExchangeDbDiscovery.ps1"
UserParameter = exchange.db[*],powershell.exe  "C:\Zabbix\Get-ExchangeDb.ps1" "$1" "$2"


            This solution was tested in Exchange 2010 and Zabbix 2.4.0.
Template, scripts and user parameters config you can find on GitHub



Wednesday 17 July 2013

Exchange 2010: How fix OWA always uses Light version


    I have met very strange situation when OWA always load light version, regardless of whether they selected to use it or not when they logged in.
    To disable this mode and allow browser to use the Full version, have the user login to OWA and open Options in the upper right corner.  Then select Accessibility and clear the checkbox for Use the blind and low vision experience, as shown below.