Пост чисто для ознакомления, т.к. не рекомендуется использовать подобный метод. Предполагаем, что были выполнены все процедуры из статьи:
Enable antispam functionality on Mailbox servers.
Которая собственно сводится к :
& $env:ExchangeInstallPath\Scripts\Install-AntiSpamAgents.ps1 Restart-Service MSExchangeTransport
Сконфигурируем настройка для Windows Update :
- Give me updates for other Microsoft Products when I update Windows
- Check for Updates but let me choose whether to download and install them
1. Check for Updates but let me choose whether to download and install them
AutomaticUpdatesNotificationLevel enumeration — https://msdn.microsoft.com/en-us/library/windows/desktop/aa385806(v=vs.85).aspx
1 = «Never check for updates»
2 = «Check for updates but let me choose whether to download and install them»
3 = «Download updates but let me choose whether to install them»
4 = «Install updates automatically»
#Automatic Updates prompts users to approve updates before it downloads or installs the updates $aunlNotifyBeforeDownload = 2 $AutoUpdate = New-Object -ComObject Microsoft.Update.AutoUpdate $Settings = $AutoUpdate.Settings $Settings.NotificationLevel = $aunlNotifyBeforeDownload $Settings.FeaturedUpdatesEnabled = $true $Settings.Save()
2. Give me updates for other Microsoft Products when I update Windows
AddServiceFlag enumeration — https://msdn.microsoft.com/en-us/library/windows/desktop/bb394819(v=vs.85).aspx
asfAllowPendingRegistration = 0x1, asfAllowOnlineRegistration = 0x2, asfRegisterServiceWithAU = 0x4
PS > 1 -bor 2 -bor 4
7
#Get Updates for Other Microsoft Products $ServiceManager = New-Object -ComObject Microsoft.Update.ServiceManager $ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
3. Какое последнее доступное обновление на портале Microsoft
$url = "http://catalog.update.microsoft.com/v7/site/Rss.aspx?q=exchange+server+2007+anti-spam&lang=en" $rss = Invoke-WebRequest $url $xml = [xml]$rss.Content $updates = $xml.rss.channel.item.where({$_.Title -match "Standard"})
PS > $updates[0] title : Microsoft Exchange Server Standard Anti-spam Filter Updates v3.3.15608.880 link : http://go.microsoft.com/fwlink/?LinkID=116494&updateid=0909e460-45b1-4991-80d0-f0e19b103e34 category : {Software, Exchange, Definition Updates} description : Microsoft Exchange Server Standard Anti-spam Filter Updates keep the heuristics for the anti-spam content filter current. pubDate : 2016-01-15 10:02:17Z guid : 0909e460-45b1-4991-80d0-f0e19b103e34#2016-01-15 10:02:17Z PS > $updates | Select @{n="Version";e={($_.Title -Split "Updates ")[1]}},pubDate Version pubDate ------- ------- v3.3.15608.880 2016-01-15 10:02:17Z v3.3.15604.885 2015-12-31 09:14:36Z v3.3.15601.886 2015-12-16 08:35:28Z v3.3.15517.887 2015-11-26 10:01:25Z v3.3.15426.898 2015-10-27 08:55:15Z PS > $updates | Select @{n="Version";e={($_.Title -Split "Updates ")[1]}},pubDate -First 1 Version pubDate ------- ------- v3.3.15608.880 2016-01-15 10:02:17Z
Последнее обновление было выпущено - 2016-01-15 10:02:17Z
4. Последнее установленное обновление Microsoft Exchange Server Standard Anti-spam Filter Updates на сервере
$pattern = "Microsoft Exchange Server Standard Anti-spam Filter Updates" $Session= New-Object -ComObject Microsoft.Update.Session $Search= $Session.CreateUpdateSearcher() $HistoryCount = $Search.GetTotalHistoryCount() $Updates = $Search.QueryHistory(0, $HistoryCount) | Where Title -match $pattern $Updates | Select @{n="Version";e={($_.Title -Split "Updates ")[1]}},Date PS > $Updates | Select @{n="Version";e={($_.Title -Split "Updates ")[1]}},Date Version Date ------- ---- v3.3.15608.880 09.02.2016 6:29:11 v3.3.15604.885 13.01.2016 6:26:42 v3.3.15601.886 24.12.2015 10:14:50 v3.3.15517.887 03.12.2015 6:10:37 v3.3.15426.898 03.11.2015 13:17:34 PS > $Updates | Select @{n="Version";e={($_.Title -Split "Updates ")[1]}},Date -First 1 Version Date ------- ---- v3.3.15608.880 09.02.2016 6:29:11
Можно посмотреть процесс , который выполнил установку обновления ClientApplicationID:
Operation : 1 ResultCode : 2 HResult : 0 Title : Microsoft Exchange Server Standard Anti-spam Filter Updates v3.3.15608.880 Description : Microsoft Exchange Server Standard Anti-spam Filter Updates keep the heuristics for the anti-spam content filter current. UnmappedResultCode : 0 ClientApplicationID : <<PROCESS>>: powershell.exe ServerSelection : 3 ServiceID : 7971f918-a847-4430-9279-4a52d1efe18d SupportUrl : http://go.microsoft.com/fwlink/?LinkID=76087&clcid=0x409
5. Получим список обновлений с серверов Microsoft и установим
Microsoft Exchange Server Standard Anti-spam Filter Updates
Есть пример Vbscript’a — Searching, Downloading, and Installing Updates , где показан пример работы.
$pattern = "Microsoft Exchange Server Standard Anti-spam Filter Updates" $Session = New-Object -ComObject "Microsoft.Update.Session" $Searcher = $Session.CreateupdateSearcher() $result = $Searcher.Search("IsInstalled=0 and Type='Software'") $updateToInstall = New-Object -ComObject "Microsoft.Update.UpdateColl" $updates = $result.Updates if($updates) { $updates | Where Title -match $pattern | Foreach { $updateToInstall.Add($_) | Out-Null } if($updateToInstall) { $downloader = $Session.CreateUpdateDownloader() "Downloading..." $downloader.Updates = $updateToInstall $downloadResult = $downloader.Download() Write-OutPut "Download Result:" Write-OutPut $downloadResult $installer = $Session.CreateUpdateInstaller() "Installing..." $installer.Updates = $updateToInstall $installationResult = $installer.Install() Write-OutPut "Installation Result:" Write-OutPut $installationResult } }
Q&A:
1. Можно ли установить Windows Management Framework 5.0 вместе с Exchange Server 2013 CU11?
Согласно статье Exchange Server Supportability Matrix — WMF 5.0 не поддерживается. В случае если вы установите данное
обновление, это приведет к невозможности работы с EMS. Поэтому следует удалить данное обновление для корректной работы.
2. Можно ли удалить обновление Microsoft Exchange Server Standard Anti-spam Filter Updates?
Данное обновление не поддерживает удаление. Т.к. свойство IsUninstallable=false.
VARIANT_TRUE if a user can uninstall the update from a computer; otherwise, VARIANT_FALSE.
3. Как обновить обновления ядра защиты от вредоносных программ и определения ?
Воспользоваться инструкцией из статьи — Download engine and definition updates
4. Есть ли модуль для работы с Windows Update?
MVP по PowerShell Michal Gajda , за что ему Спасибо, написал модуль — Windows Update PowerShell Module.
Для серверов у которых установлен WMF 5.0 для установки модуля лучше использовать OneGet:
https://www.powershellgallery.com/packages/PSWindowsUpdate/1.5.2.2
Оставьте комментарий