Bir iletinin/ekin sorunsuz iletilmesi, aynı anda şu katmanların uyumuna bağlıdır:
- HTTP / IIS / Virtual Directory
requestFiltering.requestLimits.maxAllowedContentLength(Byte)httpRuntime.maxRequestLength(KB)- (EWS/OWA) WCF bağlayıcıları:
maxReceivedMessageSizevereaderQuotas
- Exchange Transport
- Kurumsal:
Set-TransportConfig -MaxSendSize / -MaxReceiveSize - Bağlantılar:
Set-SendConnector -MaxMessageSize,Set-ReceiveConnector -MaxMessageSize - (Gerekirse) posta kutusu:
Set-Mailbox -MaxSendSize -MaxReceiveSize
- Kurumsal:
- Ağ Cihazları ve İstemci
- WAF/LB/Reverse Proxy gövde (body) boyutu ve timeout
- İstemci (mobil/Outlook) sınırları, ara güvenlik ürünleri
Base64 genişlemesi: Ekler MIME/base64 ile ~%33 büyür. 25 MB’lık dosya ~33 MB’ye çıkabilir. Bu yüzden hedefinize %30–40 pay ekleyin.
Varsayılanlara Kısa Bakış (Saha)
- ActiveSync: ~10 MB
- EWS: ~64 MB
- OWA: ~35 MB
Bunlar IIS ve WCF tarafındaki varsayılanlarla şekillenir; Exchange sürümüne göre küçük farklar olabilir.
Birimlerin Doğru Kullanımı
maxAllowedContentLength→ BytemaxRequestLength→ KBmaxReceivedMessageSize→ Byte
Hızlı Dönüşüm Tablosu (MiB esaslı)
| Hedef (MB) | KB (×1024) | Byte (×1024×1024) |
|---|---|---|
| 25 | 25 600 | 26 214 400 |
| 35 | 35 840 | 36 700 160 |
| 50 | 51 200 | 52 428 800 |
| 64 | 65 536 | 67 108 864 |
| 70 | 71 680 | 73 400 320 |
| 100 | 102 400 | 104 857 600 |
Tam MiB değerleri kullanmak (1024 tabanlı) hata ayıklamayı kolaylaştırır.
Neden Hem “Default Web Site” Hem “Exchange Back End”?
Exchange 2013/2016/2019’da Front-End (Default Web Site) proxy, Back-End (Exchange Back End) ise iş mantığını yürütür. Bu yüzden her iki tarafta da ilgili sanal dizinin limitlerini yükseltmelisiniz.
Komutlarla Artırma (appcmd)
Önemli: Komutları Yönetici CMD’de tek tek çalıştırın. Değerleri kendi hedefinize göre güncelleyin. Bitince IIS’i yeniden başlatın.
1. ActiveSync (Microsoft-Server-ActiveSync) – Örnek ~66.5 MiB
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:69730304
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:68096
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:69730304
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:system.web/httpRuntime /maxRequestLength:68096
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/Microsoft-Server-ActiveSync/" -section:appSettings /[key='MaxDocumentDataSize'].value:69730304
- requestFiltering (Byte) ve httpRuntime (KB) birlikte artırılır.
MaxDocumentDataSizeEAS özelidir (Byte).
2. EWS (Exchange Web Services) – Örnek 64 MB
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSAnonymousHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSBasicHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSNegotiateHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecuritySymmetricKeyHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpsBinding'].httpsTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /customBinding.[name='EWSWSSecurityX509CertHttpBinding'].httpTransport.maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpsBinding'].maxReceivedMessageSize:67108864
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/ews/" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpBinding'].maxReceivedMessageSize:67108864
- WCF bağlayıcıları (hem HTTP hem HTTPS) tek tek yükseltilir.
- Streaming bağlayıcıları da unutmayın.
3. OWA (Outlook on the web) – Örnek 35 MB
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Default Web Site/owa/" -section:system.web/httpRuntime /maxRequestLength:35000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.web/httpRuntime /maxRequestLength:35000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].maxReceivedMessageSize:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].maxReceivedMessageSize:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].readerQuotas.maxStringContentLength:35000000
%windir%\system32\inetsrv\appcmd.exe set config "Exchange Back End/owa/" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].readerQuotas.maxStringContentLength:35000000
Tam 35 MiB istersen Byte değerini 36 700 160 kullan.
4. IIS Yeniden Başlatma
net stop w3svc /y
net start w3svc
Alternatif: iisreset /noforce veya ilgili App Pool’ları recycle.
Transport Katmanını Eşitleyin (Aksi Hâlde Mesaj Yine Düşer)
# Organizasyon genel
Set-TransportConfig -MaxSendSize 100MB -MaxReceiveSize 100MB
# Bağlantılar
Set-SendConnector "Internet Out" -MaxMessageSize 100MB
Set-ReceiveConnector "Default Frontend EX01" -MaxMessageSize 100MB
# (Gerekirse) belirli posta kutuları
Set-Mailbox user@domain.com -MaxSendSize 100MB -MaxReceiveSize 100MB
Karşı tarafın (alıcı sistem) limitleri de nihai teslimi belirler.
WAF / LB / Reverse Proxy Ayarları – Büyük Ekler ve Uzun Bağlantılar
- Body size: WAF/LB varsayılanları (NGINX
client_max_body_size, F5/HAProxy vb.) büyük yüklemeleri 413/502/504 ile kesebilir. Sunucu hedefinize uyacak şekilde ≥ hedef+%40 ayarlayın (ör. 100 MB). - Idle timeout: MAPI/HTTP ve EWS uzun bağlantılar kurar. LB idle timeout’u ≥ 15 dk (900 sn) olmalı (tercihen 1800 sn).
- Header’lar:
X-Forwarded-For/Protogeçsin;Hostbaşlığı orijinal FQDN kalsın. - SSL re-encrypt (bridging) önerilir: Hem WAF denetimi, hem iç ağda şifreli trafik.
Doğrulama – Ne, Nerede Kontrol Edilir?
- Tarayıcı/İstemci Testleri
- OWA’dan hedef boyutta ek yüklemeyi deneyin.
- Mobilde (EAS) aynı boyutta gönderim yapın.
- EWS kullanan uygulama/servislerle test edin.
- IIS Logları
- Varsayılan yollar:
C:\inetpub\logs\LogFiles\W3SVC1(Default Web Site)C:\inetpub\logs\LogFiles\W3SVC2(Exchange Back End)
- 404.13 →
requestFilteringlimiti küçük - “Maximum request length exceeded.” →
httpRuntimeküçük
- Varsayılan yollar:
- Uygulama Günlükleri / Event Viewer
- Application / MSExchange günlükleri
- WCF quota uyarıları →
maxReceivedMessageSize / readerQuotas
- Mevcut Değerleri Listeleme
%windir%\system32\inetsrv\appcmd.exe list config "Default Web Site/ews/" -section:system.webServer/security/requestFiltering
%windir%\system32\inetsrv\appcmd.exe list config "Default Web Site/ews/" -section:system.web/httpRuntime
%windir%\system32\inetsrv\appcmd.exe list config "Exchange Back End/ews/" -section:system.serviceModel/bindings
Çok Sunuculu Ortamlarda;
- Ayarları tüm CAS/MBX sunucularında tekrarlayın.
- Otomasyon önerisi: PowerShell ile Invoke-Command veya PS Remoting kullanarak aynı komutları birden fazla sunucuya gönderin.
- Load balancer arkasında, node’ları drain alarak kesintisiz uygulayın.
CU (Cumulative Update) Sonrası Yeniden Uygulamak Gerekecektir
Exchange CU yüklemeleri sırasında web.config/app.config ve IIS’e yazdığınız özelleştirmelerin bir kısmı ezilebilir.
- Dokümante edin: Uyguladığınız tüm değerleri kaydedin.
- CU sonrası bir script ile tekrar uygulayın.
- Gerekirse
C:\inetpub\history’de IIS config geçmişi ve değişiklik karşılaştırmaları işinizi kolaylaştırır.
Sık Hata → Hızlı Yol Haritası
| Belirti | Muhtemel Neden | Çözüm |
|---|---|---|
| 404.13 | maxAllowedContentLength küçük | Default + Back End’te Byte limitini yükselt |
| “Maximum request length exceeded.” | httpRuntime.maxRequestLength küçük | KB limitini yükselt |
| WCF Quota / maxReceivedMessageSize | EWS/OWA WCF sınırı düşük | maxReceivedMessageSize/readerQuotas artır |
| 413/502/504 (WAF/LB) | Body size/timeout küçük | LB/WAF body ve timeout’u yükselt |
| Sunucuda limit yüksek, ama iletiler gitmiyor | Transport limitleri küçük | Transport/connector/mailbox limitlerini eşitle |
| Karşı tarafa gitmiyor | Alıcının sınırları düşük | Karşı tarafla boyut politikası eşitlemesi |
Bu PowerShell Scirpt’i ile ActiveSync, EWS ve OWA için IIS tarafındaki tüm ilgili limitleri (Byte/KB/WCF), tüm Exchange sunucularına uzaktan uygular, istersen Transport katmanındaki boyut sınırlarını da senkronize eder. MiB tabanlı (1024) hassas hesap yapar DryRun (plan/önizleme) ve IIS reset opsiyonu içerir.
<#
.SYNOPSIS
Exchange Server – ActiveSync/EWS/OWA ek (attachment) ve istek boyutu limitlerini
IIS (Front-End & Back-End) + WCF üzerinde parametrik olarak yükseltir.
İsteğe bağlı: Transport (org/connector/mailbox) limitlerini de senkronize eder.
.EXAMPLE
.\Set-ExchangeAttachmentLimits.ps1 -Servers EX01,EX02 -EasMB 70 -EwsMB 64 -OwaMB 35 `
-ApplyTransport -TransportMaxMB 100 -SendConnector "Internet Out" `
-ReceiveConnectors "Default Frontend EX01","Default Frontend EX02"
.EXAMPLE (Dry run)
.\Set-ExchangeAttachmentLimits.ps1 -Servers EX01 -EasMB 50 -EwsMB 64 -OwaMB 35 -DryRun
#>
[CmdletBinding(SupportsShouldProcess=$true)]
param(
[Parameter(Mandatory=$false)]
[string[]]$Servers = @($env:COMPUTERNAME),
[Parameter(Mandatory=$false)]
[int]$EasMB = 70, # Microsoft-Server-ActiveSync hedef MiB
[Parameter(Mandatory=$false)]
[int]$EwsMB = 64, # EWS hedef MiB
[Parameter(Mandatory=$false)]
[int]$OwaMB = 35, # OWA hedef MiB
[Parameter(Mandatory=$false)]
[int]$TransportMaxMB = 100, # Transport/Connector/Mailbox için hedef MiB
[Parameter(Mandatory=$false)]
[string]$SendConnector = $null, # Örn: "Internet Out"
[Parameter(Mandatory=$false)]
[string[]]$ReceiveConnectors = @(),# Örn: "Default Frontend EX01","Default Frontend EX02"
[Parameter(Mandatory=$false)]
[string[]]$Mailboxes = @(), # İsteğe bağlı: belirli mailbox’lar için sınır
[Parameter(Mandatory=$false)]
[string]$FrontEndSite = "Default Web Site",
[Parameter(Mandatory=$false)]
[string]$BackEndSite = "Exchange Back End",
[Parameter(Mandatory=$false)]
[switch]$ApplyTransport, # Transport tarafını da uygula
[Parameter(Mandatory=$false)]
[switch]$SkipIISReset, # IIS reset istemiyorsan işaretle
[Parameter(Mandatory=$false)]
[switch]$DryRun, # Sadece plan/önizleme yap
[Parameter(Mandatory=$false)]
[System.Management.Automation.PSCredential]$Credential
)
function Convert-ToBytes([int]$mb) { return [int64]$mb * 1MB } # 1MB = 1048576 byte
function Convert-ToKB ([int]$mb) { return [int] $mb * 1024 }
$EasBytes = Convert-ToBytes $EasMB; $EasKB = Convert-ToKB $EasMB
$EwsBytes = Convert-ToBytes $EwsMB
$OwaBytes = Convert-ToBytes $OwaMB; $OwaKB = Convert-ToKB $OwaMB
Write-Host "== Plan ==" -ForegroundColor Cyan
"{0,-18}: {1,6} MiB -> {2,10} KB | {3,12} Bytes" -f "ActiveSync (EAS)", $EasMB, $EasKB, $EasBytes
"{0,-18}: {1,6} MiB -> {2,10} KB | {3,12} Bytes" -f "EWS", $EwsMB, (Convert-ToKB $EwsMB), $EwsBytes
"{0,-18}: {1,6} MiB -> {2,10} KB | {3,12} Bytes" -f "OWA", $OwaMB, $OwaKB, $OwaBytes
if ($ApplyTransport) {
"{0,-18}: {1,6} MiB" -f "Transport", $TransportMaxMB | Write-Host
}
"Sunucular: {0}" -f ($Servers -join ", ") | Write-Host
if ($DryRun) { Write-Warning "DryRun aktif: komutlar uygulanmayacak, sadece gösterilecektir." }
# -- Uzakta çalışacak script block (IIS + WCF ayarları) --
$scriptBlock = {
param($FrontEndSite,$BackEndSite,$EasBytes,$EasKB,$EwsBytes,$OwaBytes,$OwaKB,$DryRun)
$appcmd = "$env:windir\system32\inetsrv\appcmd.exe"
if (-not (Test-Path $appcmd)) { throw "appcmd.exe bulunamadı: $appcmd" }
function Run-Cmd {
param([string]$cmdLine)
Write-Host " > $cmdLine"
if (-not $DryRun) {
cmd.exe /c $cmdLine | Out-Host
if ($LASTEXITCODE -ne 0) { throw "Komut hata ile döndü: $cmdLine" }
}
}
Write-Host "== [$env:COMPUTERNAME] ActiveSync =="
Run-Cmd "`"$appcmd`" set config `"$FrontEndSite/Microsoft-Server-ActiveSync/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$EasBytes"
Run-Cmd "`"$appcmd`" set config `"$FrontEndSite/Microsoft-Server-ActiveSync/`" -section:system.web/httpRuntime /maxRequestLength:$EasKB"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/Microsoft-Server-ActiveSync/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$EasBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/Microsoft-Server-ActiveSync/`" -section:system.web/httpRuntime /maxRequestLength:$EasKB"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/Microsoft-Server-ActiveSync/`" -section:appSettings /[key='MaxDocumentDataSize'].value:$EasBytes"
Write-Host "== [$env:COMPUTERNAME] EWS =="
Run-Cmd "`"$appcmd`" set config `"$FrontEndSite/ews/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$EwsBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/ews/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$EwsBytes"
$ewsBindings = @(
'EWSAnonymousHttpsBinding','EWSAnonymousHttpBinding',
'EWSBasicHttpsBinding','EWSBasicHttpBinding',
'EWSNegotiateHttpsBinding','EWSNegotiateHttpBinding',
'EWSWSSecurityHttpsBinding','EWSWSSecurityHttpBinding',
'EWSWSSecuritySymmetricKeyHttpsBinding','EWSWSSecuritySymmetricKeyHttpBinding',
'EWSWSSecurityX509CertHttpsBinding','EWSWSSecurityX509CertHttpBinding'
)
foreach ($b in $ewsBindings) {
if ($b -like '*HttpsBinding') {
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/ews/`" -section:system.serviceModel/bindings /customBinding.[name='$b'].httpsTransport.maxReceivedMessageSize:$EwsBytes"
} else {
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/ews/`" -section:system.serviceModel/bindings /customBinding.[name='$b'].httpTransport.maxReceivedMessageSize:$EwsBytes"
}
}
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/ews/`" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpsBinding'].maxReceivedMessageSize:$EwsBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/ews/`" -section:system.serviceModel/bindings /webHttpBinding.[name='EWSStreamingNegotiateHttpBinding'].maxReceivedMessageSize:$EwsBytes"
Write-Host "== [$env:COMPUTERNAME] OWA =="
Run-Cmd "`"$appcmd`" set config `"$FrontEndSite/owa/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$OwaBytes"
Run-Cmd "`"$appcmd`" set config `"$FrontEndSite/owa/`" -section:system.web/httpRuntime /maxRequestLength:$OwaKB"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.webServer/security/requestFiltering /requestLimits.maxAllowedContentLength:$OwaBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.web/httpRuntime /maxRequestLength:$OwaKB"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].maxReceivedMessageSize:$OwaBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].maxReceivedMessageSize:$OwaBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.serviceModel/bindings /webHttpBinding.[name='httpsBinding'].readerQuotas.maxStringContentLength:$OwaBytes"
Run-Cmd "`"$appcmd`" set config `"$BackEndSite/owa/`" -section:system.serviceModel/bindings /webHttpBinding.[name='httpBinding'].readerQuotas.maxStringContentLength:$OwaBytes"
Write-Host "== [$env:COMPUTERNAME] TAMAMLANDI ==" -ForegroundColor Green
}
# -- IIS & WCF uygulaması: tüm hedef sunucular --
foreach ($srv in $Servers) {
Write-Host "`n### Sunucu: $srv" -ForegroundColor Yellow
try {
if ($PSBoundParameters.ContainsKey('Credential')) {
Invoke-Command -ComputerName $srv -Credential $Credential -ScriptBlock $scriptBlock `
-ArgumentList $FrontEndSite,$BackEndSite,$EasBytes,$EasKB,$EwsBytes,$OwaBytes,$OwaKB,$DryRun
} else {
Invoke-Command -ComputerName $srv -ScriptBlock $scriptBlock `
-ArgumentList $FrontEndSite,$BackEndSite,$EasBytes,$EasKB,$EwsBytes,$OwaBytes,$OwaKB,$DryRun
}
if (-not $SkipIISReset -and -not $DryRun) {
Write-Host "IIS reset ($srv)..." -ForegroundColor DarkCyan
if ($PSBoundParameters.ContainsKey('Credential')) {
Invoke-Command -ComputerName $srv -Credential $Credential -ScriptBlock { iisreset /noforce | Out-Host }
} else {
Invoke-Command -ComputerName $srv -ScriptBlock { iisreset /noforce | Out-Host }
}
}
} catch {
Write-Error "[$srv] hata: $_"
}
}
# -- Transport katmanı (opsiyonel) --
if ($ApplyTransport) {
Write-Host "`n== Transport Senkronizasyonu ==" -ForegroundColor Cyan
# Exchange cmdlet’leri hazır mı?
if (-not (Get-Command Set-TransportConfig -ErrorAction SilentlyContinue)) {
Write-Warning "Exchange PowerShell modülleri yüklü değil gibi görünüyor. Transport adımı atlanıyor."
} else {
if ($PSCmdlet.ShouldProcess("TransportConfig","Set-TransportConfig")) {
if ($DryRun) {
Write-Host " > Set-TransportConfig -MaxSendSize ${TransportMaxMB}MB -MaxReceiveSize ${TransportMaxMB}MB"
} else {
Set-TransportConfig -MaxSendSize ("{0}MB" -f $TransportMaxMB) -MaxReceiveSize ("{0}MB" -f $TransportMaxMB)
}
}
if ($SendConnector) {
if ($PSCmdlet.ShouldProcess("SendConnector:$SendConnector","Set-SendConnector")) {
if ($DryRun) {
Write-Host " > Set-SendConnector `"$SendConnector`" -MaxMessageSize ${TransportMaxMB}MB"
} else {
Set-SendConnector $SendConnector -MaxMessageSize ("{0}MB" -f $TransportMaxMB)
}
}
}
foreach ($rc in $ReceiveConnectors) {
if ($PSCmdlet.ShouldProcess("ReceiveConnector:$rc","Set-ReceiveConnector")) {
if ($DryRun) {
Write-Host " > Set-ReceiveConnector `"$rc`" -MaxMessageSize ${TransportMaxMB}MB"
} else {
Set-ReceiveConnector $rc -MaxMessageSize ("{0}MB" -f $TransportMaxMB)
}
}
}
foreach ($mbx in $Mailboxes) {
if ($PSCmdlet.ShouldProcess("Mailbox:$mbx","Set-Mailbox")) {
if ($DryRun) {
Write-Host " > Set-Mailbox $mbx -MaxSendSize ${TransportMaxMB}MB -MaxReceiveSize ${TransportMaxMB}MB"
} else {
Set-Mailbox $mbx -MaxSendSize ("{0}MB" -f $TransportMaxMB) -MaxReceiveSize ("{0}MB" -f $TransportMaxMB)
}
}
}
}
}
Write-Host "`n== BİTTİ ==" -ForegroundColor Green
Write-Host "Not: Exchange CU sonrası web.config/IIS özelleştirmeleri ezilebilir; bu betiği CU’dan sonra tekrar çalıştırın."
Kullanım önerileri
- Tüm CAS/MBX node’larında IIS/WCF limitlerini uygula + Transport’u senkronize et:
.\Set-ExchangeAttachmentLimits.ps1 `
-Servers EX01,EX02 `
-EasMB 70 -EwsMB 64 -OwaMB 35 `
-ApplyTransport -TransportMaxMB 100 `
-SendConnector "Internet Out" `
-ReceiveConnectors "Default Frontend EX01","Default Frontend EX02"
- Önizleme (DryRun):
.\Set-ExchangeAttachmentLimits.ps1 -Servers EX01 -EasMB 50 -EwsMB 64 -OwaMB 35 -DryRun
- IIS reset’i atla (bakım penceresinde manuel yapacaksan):
.\Set-ExchangeAttachmentLimits.ps1 -Servers EX01,EX02 -EasMB 70 -EwsMB 64 -OwaMB 35 -SkipIISReset
İpucu: MIME/base64 genişlemesi nedeniyle hedef ek boyutunuzun %30–40 üstünü limit olarak verin (ör. 25 MB hedef için ~35 MB). CU (Cumulative Update) sonrasında bu betiği tekrar çalıştırmayı unutmayın.