The error correct in two ways :)
1. Install last CU for Exchange
2. Close and open "Exchange Management Shell"
1. Install last CU for Exchange
2. Close and open "Exchange Management Shell"
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 |
001
002 |
Uninstall-TransportAgent -Name "MyAttachmentLog"
Restart-Service MSExchangeTransport |
001
|
Get-Command Exsetup.exe | ForEach{$_.FileVersionInfo}
|
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 |
001
|
Disable-TransportAgent "Attachment Filtering Agent"
|
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
|
002
|
Get-ReceiveConnector EncryptMessage | fl guid
|
003
|
Set-AttachmentFilterListConfig –ExceptionConnectors "your guid"
|
001
|
<add key="SkipDigitalSignedMessageFromAttachmentFilterAgent" value="true" />
|
017
|
<serverRuntime uploadReadAheadSize="1048576" />
|
Add-ADPermission "User 1" -User "User 2" -Extendedrights "Send As"
|
$list = (Get-ContentFilterConfig).BypassedRecipients $list.add("i-evgeny@contoso.com") Set-ContentFilterConfig -BypassedRecipients $list
Set-Mailbox i-evgeny@contoso.com -AntispamBypassEnabled $true -SCLJunkEnabled $true -SCLJunkThreshold 4
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
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"
# 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)
# 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
diskshadow -s C:\Scripts\VSSClean.txt
$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