Como puedo poner una alerta de actualizaciones de windows criticas de mis servidores monitorizados?
Algún script? como podría ejecutarlo?
Gracias a todos de antemano.
Algún script? como podría ejecutarlo?
Gracias a todos de antemano.
$updateObject = New-Object -ComObject Microsoft.Update.Session
$updateObject.ClientApplicationID = "WinUpdateCheck"
$updateSearcher = $updateObject.CreateUpdateSearcher()
$searchResults = $updateSearcher.Search("IsHidden=0 and IsInstalled=0")
$mandatoryUpdates = $searchResults.Updates | Where-Object IsMandatory -eq $true
$updates = [System.Collections.ArrayList]::new()
$totalsize = 0;
foreach($update in $mandatoryUpdates) {
$totalsize = $totalsize + $update.MaxDownloadSize;
$newUpdate = New-Object -TypeName psobject
$newUpdate | Add-Member -NotePropertyName title -NotePropertyValue $update.Title
$newUpdate | Add-Member -NotePropertyName size -NotePropertyValue $update.MaxDownloadSize
[void]$updates.add($newUpdate);
}
$new_obj = New-Object -TypeName psobject
$new_obj | Add-Member -NotePropertyName count -NotePropertyValue $mandatoryUpdates.Count
$new_obj | Add-Member -NotePropertyName updates -NotePropertyValue $updates
$new_obj | Add-Member -NotePropertyName totalsize -NotePropertyValue $totalsize
Write-Host ($new_obj | ConvertTo-Json)
{
"count": 4,
"updates": [
{
"title": "Actualización de inteligencia de seguridad para Microsoft Defender Antivirus - KB2267602 (Versión 1.381.2092.0)",
"size": 961488592
},
{
"title": "Dell Inc. - Display - Dell E198WFP(Digital)",
"size": 22836
},
{
"title": "Realtek - Net - 7/5/2017 12:00:00 AM - 10.19.705.2017",
"size": 167962
},
{
"title": "Lenovo - System - 1.2.0.11",
"size": 14593210
}
],
"totalsize": 976272600
}
UserParameter=GetWindowsUpdatesForInstall,powershell.exe -NoProfile -ExecutionPolicy bypass -File "C:\Program Files\Zabbix Agent 2\scripts\GetWindowsUpdatesForInstall.ps1"

Comment