Showing posts with label Microsoft Exchange. Show all posts
Showing posts with label Microsoft Exchange. Show all posts

Wednesday, July 19, 2017

TransportAgentFactory type must be the Microsoft .NET class type of the transport agent factory.

The error correct in two ways :)

1. Install last CU for Exchange
2. Close and open "Exchange Management Shell"

How to log the names and size of attachments in messages (Exchange 2013/2016)

I want to share with you "Exchange TransportAgent" which log the names and size of attachments.
I test this agent on Exchange 2013 CU17 (15.00.1320.004) and Exchange 2016 CU6 (15.01.1034.026).

Download "AttachmentLog TransportAgent for Exchange 2013 CU17"

Download "AttachmentLog TransportAgent for Exchange 2016 CU6"

The location of the folder with logs can be controlled from the file "AttachmentLog.Config.xml"

Example of install:

001
002
003
004
005
$EXDIR="C:\MyAgents\AttachmentLog"
Net Stop MSExchangeTransport
Install-TransportAgent -Name "MyAttachmentLog" -AssemblyPath $EXDIR\AttachmentLog.dll -TransportAgentFactory MyAttachmentLog.Exchange.Agents.AttachmentLog.AttachmentLogFactory
Enable-TransportAgent -Identity "MyAttachmentLog"
Net Start MSExchangeTransport

Example of uninstall:

001
002
Uninstall-TransportAgent -Name "MyAttachmentLog"
Restart-Service MSExchangeTransport

Check Exchange version:

001
Get-Command Exsetup.exe | ForEach{$_.FileVersionInfo}

Example of results:



Sunday, October 16, 2016

Exchange Dynamic Distribution Group Members

  Popular articles MS "View members of a dynamic distribution group" describes how you can get a list of users who will delivery.
   But if you create a dynamic distribution group based on the Organizational Unit, this article does not apply :)
  This can be verified if to do so:

$FTE = Get-DynamicDistributionGroup "Full Time Employees"

and see the value of:

$FTE.RecipientFilter

there is no filter "Organizational Unit"
   To add an OU, you can use the filter type:

Get-Recipient -OrganizationalUnit $FTE.RecipientContainer.DistinguishedName


Tuesday, March 8, 2016

Exchange 2010/2013 coexistence IIS settings

Some IIS settings must be installed to correct work Exchange 2013.

MBX Servers 2013 (fix display Organization Units in the ECP):

"C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess\ecp\web.config"
if no values, setting values <add key="GetListDefaultResultSize" value="2000" />

CAS Servers 2013 (fix access mailboxes on Exchange 2010 from 2013):

"C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\autodiscover\web.config"
"C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\ews\web.config"
if no values, setting values <serverRuntime uploadReadAheadSize="1048576" />


Wednesday, November 4, 2015

Logparser in CAS Exchange 2013 for users and their version of Outlook

In this article I want to share the search script in logs CAS Exchange 2013 current users and their version of Outlook. The script requires two CAS server, the script must be run under the administrator of these servers, the path to the log specified standard.

Download ex13_username_version.ps1

$cas1 = "cas1.blogspot.com"
$cas2 = "cas2.blogspot.com"
$LogFile = "ex13_username_version.csv"

$LogParser = "C:\Program Files (x86)\Log Parser 2.2\LogParser.exe"
$LogTime = Get-Date -Format "yyyyMMdd"
$LogHProxy = "RpcHttp" + $LogTime + "*.log"
$query = """SELECT DISTINCT EXTRACT_TOKEN(EXTRACT_TOKEN(EventData,1,';'),1,'=') as username,EXTRACT_TOKEN(EXTRACT_TOKEN(EventData,2,';'),1,'}') as client `
         into $($LogFile) FROM '\\$($cas1)\c$\Program Files\Microsoft\Exchange Server\V15\Logging\RpcHttp\W3SVC1\$($LogHProxy)', `
         '\\$($cas2)\c$\Program Files\Microsoft\Exchange Server\V15\Logging\RpcHttp\W3SVC1\$($LogHProxy)' `
         where (EXTRACT_TOKEN(EXTRACT_TOKEN(EventData,1,';'),1,'=') NOT LIKE '%{%' AND EXTRACT_TOKEN(EXTRACT_TOKEN(EventData,1,';'),1,'=') IS NOT null `
         AND EXTRACT_TOKEN(EXTRACT_TOKEN(EventData,2,';'),1,'}') IS NOT null)"""
$LogParserStr = "-i:csv -o:csv " + $query + " –nSkipLines:4"
$LP = Start-Process -FilePath $LogParser -ArgumentList $LogParserStr -Wait -Passthru -NoNewWindow

Friday, October 30, 2015

Exchange, EventID 1135 This could also be due to the node having lost communication with other active nodes in the failover cluster.

In this article, I provide a list of actions to resolve the error 1135 Exchange 2013 in Windows 2012 R2. Windows 2012 R2 use IPv6 for Failover Cluster...

1. Check IPv6 enabled (network adapter and registry)

2. Check firewall rules, add expections:
Core Networking - Neighbor Discovery Advertisement (ICMPv6-In)
Core Networking - Neighbor Discovery Solicitation (ICMPv6-In)
Failover Cluster Manager (ICMP6-ER-In)
Failover Clusters (ICMP6-ER-In)
Failover Clusters (ICMP6-ERQ-In)
001
002
003
004
005
netsh.exe advfirewall firewall set rule name="Core Networking - Neighbor Discovery Advertisement (ICMPv6-In)" new enable=Yes profile=any
netsh.exe advfirewall firewall set rule name="Core Networking - Neighbor Discovery Solicitation (ICMPv6-In)" new enable=Yes profile=any
netsh.exe advfirewall firewall set rule name="Failover Cluster Manager (ICMP6-ER-In)" new enable=Yes profile=any
netsh.exe advfirewall firewall set rule name="Failover Clusters (ICMP6-ER-In)" new enable=Yes profile=any
netsh.exe advfirewall firewall set rule name="Failover Clusters (ICMP6-ERQ-In)" new enable=Yes profile=any

3. Install updates:
http://support.microsoft.com/kb/3033918 Disk resource does not come online in Windows Server 2012 R2 or Windows Server 2008 R2-based failover cluster
http://support.microsoft.com/kb/3066427  You cannot compress Windows image files because of memory leak in Windows 8.1
http://support.microsoft.com/kb/3078584  0x133 or 0x13C Stop error occurs in Windows 8.1 or Windows Server 2012 R2
http://support.microsoft.com/kb/3033930  Hotfix increases the 64K limit on RIO buffers per process for Azure service in Window
http://support.microsoft.com/kb/3077354  Computer freezes when WFP leaks nonpaged pool memory in Windows Server 2012 R2
http://support.microsoft.com/kb/3065013  "0x0000007F" and "0x0000009F" Stop errors in Windows 8.1 or Windows Server 2012 R2
https://support.microsoft.com/kb/3013769 December 2014 update rollup for Windows RT 8.1, Windows 8.1, and Windows Server 2012 R2
https://support.microsoft.com/en-us/kb/3076953 Cluster services go offline when there's a connectivity issue in Windows Server 2012 R2 or Windows Server 2012
Other updates https://support.microsoft.com/en-us/kb/2920151 Recommended hotfixes and updates for Windows Server 2012 R2-based failover clusters

4. If you use different network adapters, disable "Register this connection’s address in DNS" checkbox on the advanced TCP properties of the network adapter used for Cluster Communication/Exchange replications.

5. Check bind order with nvspbind for network adapter http://blogs.technet.com/b/askcore/archive/2010/04/15/windows-server-2008-failover-clusters-networking-part-4.aspx, eg:

6. If use VMWare ESX:
6.1 Remove vShield (VMware Guest Introspection Network Filter Driver, VMware Guest Introspection Driver)
6.2 Increase value (Large Rx Buffers, Small Rx Buffers, Rx Ring # 1, Rx Ring # 2) to maximize network cards VMXnet3 kb.vmware.com/kb/2039495
6.3 Update ESX http://kb.vmware.com/kb/2124669
6.4 Check CPU settings http://kb.vmware.com/kb/1005362

Tuesday, October 20, 2015

Exchange Edge 2010/2013 corrupt encrypted (smime) message

In this article I want to talk about damage to encrypted messages Exchange Edge 2010/2013.
First, you must make sure that the antivirus program is made exception for the recipient or to the sender or IP address.
With the shutdown agents found that the message is corrupt "Attachment Filtering Agent".
There are three ways to correct the error:
1. Disable "Attachment Filtering Agent"
001
Disable-TransportAgent "Attachment Filtering Agent"
2. Make an exception for IP address in "Attachment Filtering Agent":
create new receive connector, eg
001
New-ReceiveConnector -Name EcryptMessage -Bindings 1.1.1.1:25 -RemoteIPRanges 2.2.2.1,2.2.2.2 -AuthMechanism none -Fqdn mx1.blogspot.com -MaxMessageSize 60Mb -PermissionGroups AnonymousUsers -ProtocolLoggingLevel Verbose -TarpitInterval 00:00:00
Find Guid for new connector
002
Get-ReceiveConnector EncryptMessage | fl guid
Add connector to "Attachment Filtering Agent" config
003
Set-AttachmentFilterListConfig –ExceptionConnectors "your guid"
3. Disable checking encrypted messages in "Attachment Filtering Agent":
Add key in section <AppSettings> for file "C:\Program Files\Microsoft\Exchange Server\V15\Bin\EdgeTransport.exe.config"
001
<add key="SkipDigitalSignedMessageFromAttachmentFilterAgent" value="true" />

I like the third way.

A more detailed study of the problem by using "PipelineTracing" we see that the "Attachment Filtering Agent" changes the encoding message.

Monday, September 14, 2015

Exchange 2013 "(413) Request Entity Too Large"

This error "(413) Request Entity Too Large" occurs when working with Web services Exchange 2013. Caught by a cmdlet "Test-OutlookWebServices" or Wireshark

Fix you can do this on CAS servers:
1. Back up files
C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\autodiscover\web.config
C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\ews\web.config
2. Replace the value "uploadReadAheadSize" of 0 to 1048576 (bytes) in both files

017
 <serverRuntime uploadReadAheadSize="1048576" />

Friday, June 19, 2015

Very slow work of a mailbox in Exchange 2010

      Faced with an unexpected problem: a single mailbox in the vault is very slow and the Outlook and OWA. After a long diagnostic wake up the user creates a tasks for subordinates from Outlook. The solution was to reset the incorrect synchronize tasks. This can be done manually:
1. Click on the task with an exclamation point in a condition
2. Selected from single copies of tasks
3. click "save this copy"

or by running the Outlook with a parameter /resettodobar

Friday, May 29, 2015

Exchange 2013 "0x80070005-00000000-00000000"

Unexpected error "0x80070005-00000000-00000000" can be obtained in an environment of coexistence of Exchange 2010 and Exchange 2013. This error occurs when you send as of another mailbox. For example,
"user 1" mailbox in Exchange Server 2010
"user 2" mailbox in Exchange Server 2013
"user 2" has "full access" to a "user 1" mailbox, but does not have the right to "send as"
"user 2" tries to forward a letter from the "user 1" mailbox, and the "user 2" receives an error "0x80070005-00000000-00000000"

For the granting of the right to "send as" of the need to execute a command in the Exchange Managment Shell:

Add-ADPermission "User 1" -User "User 2" -Extendedrights "Send As"

Sunday, May 10, 2015

Exchange 2010 Managment Console - Queue Viewer. High CPU load.

If the Exchange server console is performed for a long time "Exchange Managment Console - Queue Viewer" it begins to consume large amounts of CPU time, which leads to periodically disable the Outlook. Such situations occur frequently in the management Exchange server administrators group. To avoid such situations, you need to configure limits on a remote RDP sessions. This can be done in person at the relevant servers or Group Policy:

the first method
Administrative Tools - Remote Desktop Services - Remote Desktop Session Host Configuration - RDP-Tcp Properties - Sessions


second method
Computer Configuration - Administrative Templates - Windows Components - Remote Desktop Services - Remote Desktop Session Host - Session Time Limits - Set time limit for disconnected sessions - End a disconnected Session e.g. 10 min

Monday, May 4, 2015

Two ways to add a recipient to exclude spam filter Microsoft Exchange 2010/2013 Edge

In this article I want to write about two ways to add a recipient to the list of exceptions antispam check Microsoft Exchange 2010/2013. The first method is certainly in which the entire outer pouch assigned rating (SCL) of "-1", and usually such mail falls into "Inbox" the recipient's mailbox. The second method allows you to deliver the external mail with a score (SCL) on the basis of which it is possible to move the mail to the "Junk Email" folder.

Method one:
run on Exchange 2010/2013 Edge
$list = (Get-ContentFilterConfig).BypassedRecipients
$list.add("i-evgeny@contoso.com")
Set-ContentFilterConfig -BypassedRecipients $list


Method two:
run on Exchange 2010/2013 FE/backend
Set-Mailbox i-evgeny@contoso.com -AntispamBypassEnabled $true -SCLJunkEnabled $true -SCLJunkThreshold 4


To avoid conflicts must be used for the recipient only one method.

Monday, October 27, 2014

Steps to migrate the configuration Exchange 2010 Edge to Exchange 2013 Edge

In this article I want to share powershell commands with which you can quickly import a basic configuration Exchange 2013 Edge server. First, export the configuration from the source server Exchange Edge 2010, before each command is written which configuration is exported:

New-Item -ItemType directory -Path C:\ex-config -ea 0
## IP Allow list
Get-IPAllowListEntry | Select IPRange | Export-Csv c:\ex-config\ip-allow.csv
## IP Block list
Get-IPBlockListEntry | Select IPRange | Export-Csv c:\ex-config\ip-block.csv
## Bypassed Recipients (whitelist to)
Get-ContentFilterConfig | select BypassedRecipients -expand BypassedRecipients | 
select local, domain | export-csv c:\ex-config\BypassedRecipients.csv -notypeinformation
## Bypassed Senders  (whitelist from)
Get-ContentFilterConfig | select BypassedSenders -expand BypassedSenders | 
select local, domain | export-csv c:\ex-config\BypassedSenders.csv -notypeinformation
## Blocked Senders  (blacklist from)
Get-SenderFilterConfig | select BlockedSenders -expand BlockedSenders | 
select local, domain | export-csv c:\ex-config\BlockedSenders.csv -notypeinformation
## Blocked Senders domain (blacklist from)
Get-SenderFilterConfig | select BlockedDomains -expand BlockedDomains | 
select domain | export-csv c:\ex-config\BlockedDomains.csv -notypeinformation
## Blocked Senders domain and sub (blacklist from)
Get-SenderFilterConfig | select BlockedDomainsAndSubdomains -expand BlockedDomainsAndSubdomains | 
select domain | export-csv c:\ex-config\BlockedDomainsAndSubdomains.csv -notypeinformation
## Blocked Recipients (blacklist to)
Get-RecipientFilterConfig | select BlockedRecipients -expand BlockedRecipients | 
select local, domain | export-csv c:\ex-config\BlockedRecipients.csv -notypeinformation
## Transport rules
$file = Export-TransportRuleCollection
Set-Content -Path "C:\ex-config\Ex2010TransportRules.xml" -Value $file.FileData -Encoding Byte

Then you need to copy a folder c:\ex-config with configuration files to the destination server and execute commands powershell:

## IP Allow list
$IPList = Import-Csv c:\ex-config\ip-allow.csv
ForEach ($SingleIP in $IPList) { Add-IPAllowListEntry -IPRange $SingleIP.IPRange }
## IP Block list
$IPList = Import-Csv c:\ex-config\ip-block.csv
ForEach ($SingleIP in $IPList) { Add-IPBlockListEntry -IPRange $SingleIP.IPRange }
## Bypassed Recipients (whitelist to)
$MList2 = (Get-ContentFilterConfig).BypassedRecipients
$MList = Import-Csv c:\ex-config\BypassedRecipients.csv
ForEach ($mail in $MList)
{
    $mail2 = $mail.local + "@" + $mail.domain
    $Mlist2.add($mail2)
}
Set-ContentFilterConfig -BypassedRecipients $Mlist2
## Bypassed Senders  (whitelist from)
$MList2 = (Get-ContentFilterConfig).BypassedSenders
$MList = Import-Csv c:\ex-config\BypassedSenders.csv
ForEach ($mail in $MList)
{
    $mail2 = $mail.local + "@" + $mail.domain
    $Mlist2.add($mail2)
}
Set-ContentFilterConfig -BypassedSenders $Mlist2
## Blocked Senders  (blacklist from)
$MList2 = (Get-SenderFilterConfig).BlockedSenders
$MList = Import-Csv c:\ex-config\BlockedSenders.csv
ForEach ($mail in $MList)
{
    $mail2 = $mail.local + "@" + $mail.domain
    $Mlist2.add($mail2)
}
Set-SenderFilterConfig -BlockedSenders $Mlist2
## Blocked Senders domain (blacklist from)
$MList2 = (Get-SenderFilterConfig).BlockedDomains
$MList = Import-Csv c:\ex-config\BlockedDomains.csv
ForEach ($mail in $MList)
{
    $Mlist2.add($mail.domain)
}
Set-SenderFilterConfig -BlockedDomains $Mlist2
## Blocked Senders domain and sub (blacklist from)
$MList2 = (Get-SenderFilterConfig).BlockedDomainsAndSubdomains
$MList = Import-Csv c:\ex-config\BlockedDomainsAndSubdomains.csv
ForEach ($mail in $MList)
{
    $Mlist2.add($mail.domain)
}
Set-SenderFilterConfig -BlockedDomainsAndSubdomains $Mlist2
## Blocked Recipients (blacklist to)
$MList2 = (Get-RecipientFilterConfig).BlockedRecipients
$MList = Import-Csv c:\ex-config\BlockedRecipients.csv
ForEach ($mail in $MList)
{
    $mail2 = $mail.local + "@" + $mail.domain
    $Mlist2.add($mail2)
}
Set-RecipientFilterConfig -BlockedRecipients $Mlist2
## Transport rules
[Byte[]]$Data = Get-Content -Path "C:\ex-config\Ex2010TransportRules.xml" -Encoding Byte -ReadCount 0
Import-TransportRuleCollection -FileData $Data

You also need to perform general configuration commands, here are some examples:

New-ReceiveConnector -Name Inet -Bindings <your ip eg 1.1.1.1>:25 -RemoteIPRanges 0.0.0.0-255.255.255.255 
-Fqdn <your server fqdn eg mx1.blogspot.com> -AuthMechanism none -MaxMessageSize <your limit eg 60Mb>

-PermissionGroups AnonymousUsers -ProtocolLoggingLevel Verbose
Set-ReceiveConnector <your internal server connector> -Bindings <your ip eg 10.1.1.1>:25 -MaxMessageSize <your limit eg 60Mb> -ProtocolLoggingLevel Verbose

Add-IPBlockListProvider -Name Spamhaus -LookupDomain zen.spamhaus.org 
-AnyMatch $true -Enabled $true -RejectionResponse "Your message was rejected because the IP address of the sending server {0} is blacklisted by {1} Lookup Domain {2}"
Add-IPBlockListProvider -Name "Dul Sorbs" -LookupDomain dul.dnsbl.sorbs.net 
-AnyMatch $true -Enabled $true -RejectionResponse "Your message was rejected because the IP address of the sending server {0} is blacklisted by {1} Lookup Domain {2}"
Add-IPBlockListProvider -Name Spamcop -LookupDomain bl.spamcop.net 
-AnyMatch $true -Enabled $true -RejectionResponse "Your message was rejected because the IP address of the sending server {0} is blacklisted by {1} Lookup Domain {2}"

Set-ContentFilterConfig -QuarantineMailbox junk@blogspot.com -SCLRejectEnabled $False -SCLQuarantineThreshold 7 -SCLQuarantineEnabled $True

Set-TransportServer <your server name> -ConnectivityLogPath "D:\TransportRoles\Logs\Connectivity" 
-MessageTrackingLogPath "D:\TransportRoles\Logs\MessageTracking" -ReceiveProtocolLogPath "D:\TransportRoles\Logs\ProtocolLog\SmtpReceive" 
-SendProtocolLogPath "D:\TransportRoles\Logs\ProtocolLog\SmtpSend" -AgentLogPath "D:\TransportRoles\Logs\ProtocolLog\AgentLog"

Wednesday, June 4, 2014

Errors when installing kb2936871 "Update Rollup 6 for Exchange Server 2010 Service Pack 3"

     Yesterday installed a new update "Update Rollup 6 for Exchange Server 2010 Service Pack 3" to the mail server. The update is available on the link "http://support.microsoft.com/kb/2936871/en-us". Today I want to warn error encountered during an installation . My DAGFileShareWitnesses placed on one of the CAS servers. CAS servers on NetScaler balanced.
1. When installed on a server with the role mailboxes restart service on CAS servers. And as it was supposed to make everything transparent to the user - the first surprise flurry of calls - "but what about the mail?"
2. Second surprise : when you install on a server with the role of CAS permissions to update DAGFileShareWitnesses were changed because of what the mail databases started driving mailboxes between servers. Then open Event Viewer/System you found errors event id 1564 "File Share Witness (): Failed is offline.". To fix this add the right group Exchange Trusted Subsystem on shared folder in DAGFileShareWitnesses as shown in Figure and Stop/Start Cluster Service in Failover Cluster Manager.

Friday, May 23, 2014

Monitoring Exchange ActiveSync connection for specific users

To prevent a situation where the company managers have problems with reading mail from mobile devices, it is desirable to know about problems in advance. This can be done for example in the following script, which sends e-mail the last known good synchronization and the difference with the current time. If the time difference is greater than 3:00 script highlighted.
In this script, you need to replace the following values
"MyManager", "MyDirector" - Display Name from Active Directory
$msg.From, $msg.To.add, $SMTPServer - Your SMTP parameters

Download monitor_active_sync.ps1

# Load Exchange commands
if (!(Get-Command Get-ExchangeServer -ErrorAction SilentlyContinue))
{
    if (Test-Path "C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1")
    {
        . 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
        Connect-ExchangeServer -auto
    }
    elseif (Test-Path "C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1")
    {
        Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Admin
        .'C:\Program Files\Microsoft\Exchange Server\bin\Exchange.ps1'
    }
    else
    {
        throw "Exchange Management Shell cannot be loaded"
    }
}

$DeltaTime = $DateNow = $MobileDevices = @()

$DateNow = Get-date
$MobileDevices = Get-ActiveSyncDevice | where { $_.identity -match "MyManager" -or $_.identity -match "MyDirector" } | Sort-Object identity | Get-ActiveSyncDeviceStatistics

$msg = new-object Net.Mail.MailMessage
$msg.Body = "<html> 
<body> 
<font size=""1"" face=""Arial,sans-serif""> 
<h3 align=""center"">Notice about ActiveSync</h3> 
</font><table border=""0"" cellpadding=""3"" style=""font-size:8pt;font-family:Arial,sans-serif""> 
<tr bgcolor=""#009900""> 
<th><font color=""#ffffff"">Identity:</font></th> 
<th><font color=""#ffffff"">DeviceUserAgent:</font></th> 
<th><font color=""#ffffff"">LastSuccessSync GMT:</font></th> 
<th><font color=""#ffffff"">DeltaTime:</font></th> 
</tr>"

Foreach ($MobileDevice in $MobileDevices)
{
    write-host $MobileDevice.Identity "User Agent: " $MobileDevice.DeviceUserAgent "Success Sync GMT: "  $MobileDevice.LastSuccessSync
    if ($MobileDevice.LastSuccessSync)
    {
        $DeltaTime = new-timespan -start ($DateNow.ToUniversalTime()) -end ($MobileDevice.LastSuccessSync)
        write-host "Last sync delta time" $DeltaTime
    }
    else { write-host "No sync" }
    if ($DeltaTime -le '-3:00:00.0000000') { write-host "DeltaTime great 3 hour" }
    $msg.Body += "<tr bgcolor=""#dddddd""><th>$($MobileDevice.Identity)</th>
<th>$($MobileDevice.DeviceUserAgent)</th>
<th>$($MobileDevice.LastSuccessSync)</th>"
    if ($DeltaTime -le '-3:00:00.0000000') { $msg.Body += "<th><b><span style=""color: red;"">$($DeltaTime)</span></b></th>
</tr>"
    }
    else { $msg.Body += "<th>$($DeltaTime)</th>
</tr>"
    }
}

$msg.Body += "</table>
</body></html>"

$msg.Body | Out-File .\report.html
$msg.IsBodyHTML = $true
$msg.From = "FromEmail@YourDomain"
$msg.To.add("YourEmail@YourDomain")
$msg.Subject = "Notice about ActiveSync"
$SMTPServer = "YourEmailServer"
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25)
$SMTPClient.Send($Msg)

How quickly free up disk space with transaction logs Exchange

If you have a critical situation occurred and an urgent need to release the disc with transaction logs, you can cheat Exchange server as if you made ​​a backup. To do this, follow these steps:

1. Example: Create a folder on drive "C:\Scripts"
2. "C:\Scripts" folder create a file "VSSClean.txt" with content (letters of your disks should be corrected):
# DiskShadow Script File to Fix VSS Writers (PLEASE Do NOT REMOVE)

begin backup
add volume D:
add volume E:
create
end backup
list shadows all
delete shadows all
# End of script

3. "C:\Scripts" folder create a file "VSSClean.cmd" with content:
diskshadow -s C:\Scripts\VSSClean.txt

4. Finally execute the file VSSClean.cmd

A good practice is to create a task on schedule to check the disk is full with logs. For example, the script below checks powershell disc name (in my case it "TLOGS") and if the space is less than 50 gigabytes script is run to remove the logs.

$disks = Get-WmiObject win32_logicaldisk | Where-Object { $_.drivetype -eq 3 }
foreach ($disk in $disks)
{
    $a1 = [math]::Round(($disk.FreeSpace/1073741824), 0)
    if ($disk.VolumeName -match "TLOGS" -and $a1 -le 50)
    {
        start-process C:\Scripts\VSSClean.cmd
    }
}

Download monitor_tlogs.ps1
Download VSSClean.cmd
Download VSSClean.txt

Friday, May 9, 2014

Error "The type initializer for 'Microsoft.Exchange.Diagnostics.ExTraceConfiguration' threw an exception."

After installing KB2506143 "Windows Management Framework 3.0" having problems using Powershell scripts for Microsoft Exchange 2010 with the following error "The type initializer for 'Microsoft.Exchange.Diagnostics.ExTraceConfiguration' threw an exception.". Windows offers a search solution on the Internet, but found nothing. Therefore, we must do the following:
1. Reinstall Exchange Manage Tools
2. In batch scripts to add the parameter "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -version 2.0"
3. Rename or delete folders in profile "%userprofile%\AppData\Roaming\Microsoft\Exchange\RemotePowerShell"

Wednesday, April 9, 2014

Exchange 2003 Messages with unreachable destination, event id 4003, 984



Faced today with an unusual problem on the server Exchange 2003. Messages to one of the domains are stuck in the queue: "Messages with unreachable destination". Despite all attempts to restart the services and server messages do not go, but using telnet message domain go successfully. To understand the reason I enable the Diagnostic Logging in properties on Exchange server:



and found an interesting event id 4003 and 984 in the Application log: “The domain 'contoso.com' is currently unreachable.”, “NextHopType=CURRENTLY_UNREACHABLE” 


The decision was simple: I created a special connector for this domain and messages go.