Actualizar firmas de Microsoft Defender Antivirus
Fuerza la actualización de definiciones de Microsoft Defender Antivirus y verifica que quedaron de menos de 48 horas.
Ejemplo en México
Manufactura de autopartes en Celaya, 120 equipos de planta
Los equipos de planta no siempre alcanzan el servidor de actualizaciones y quedan con firmas viejas.
remediate-antivirus-definitions.ps1Los equipos atrasados descargan firmas nuevas y salen de la lista de problemas.
Cómo implementarlo
- En el centro de administración de Microsoft Intune ve a Dispositivos > Administrar dispositivos > Scripts y correcciones (Scripts and remediations) > Remediations > Crear paquete de scripts.
- En Configuración sube detect-antivirus-definitions-outdated.ps1 como script de detección y remediate-antivirus-definitions.ps1 como script de corrección.
- Deja desactivadas "Ejecutar con las credenciales del usuario" y "Aplicar verificación de firma", asígnalo primero a un grupo piloto y elige la frecuencia.
- Revisa en el paquete cuántos equipos quedaron corregidos y cuáles siguen con error.
Ver el código completo de remediate-antivirus-definitions.ps1
<#
.TITLE
Windows Defender Definition Update Remediation
.SYNOPSIS
Updates Windows Defender antivirus definitions
.DESCRIPTION
Forces Windows Defender signature updates and verifies they were successful.
.TAGS
Remediation,Action
.REMEDIATIONTYPE
Remediation
.PAIRSCRIPT
detect-antivirus-definitions-outdated.ps1
.PLATFORM
Windows
.MINROLE
Intune Service Administrator
.PERMISSIONS
DeviceManagementManagedDevices.ReadWrite.All
.AUTHOR
Ugur Koc
.VERSION
1.0
.CHANGELOG
1.0 - Initial version
.LASTUPDATE
2025-06-09
.EXAMPLE
.\remediate-antivirus-definitions.ps1
.NOTES
Runs in SYSTEM context
#>
$ErrorActionPreference = "Stop"
try {
Write-Output "Starting definition update..."
# Get current definition version
$beforeUpdate = Get-MpComputerStatus -ErrorAction Stop
$beforeVersion = $beforeUpdate.AntivirusSignatureVersion
Write-Output "Current version: $beforeVersion"
# Update signatures
Write-Output "Downloading latest definitions..."
Update-MpSignature -ErrorAction Stop
# Wait for update to complete (max 2 minutes)
$maxWait = 120
$waited = 0
while ($waited -lt $maxWait) {
Start-Sleep -Seconds 10
$waited += 10
$currentStatus = Get-MpComputerStatus -ErrorAction Stop
if ($currentStatus.AntivirusSignatureVersion -ne $beforeVersion) {
Write-Output "Definitions updated to version: $($currentStatus.AntivirusSignatureVersion)"
break
}
}
# Verify update
$finalStatus = Get-MpComputerStatus -ErrorAction Stop
$definitionAge = ((Get-Date) - $finalStatus.AntivirusSignatureLastUpdated).TotalHours
if ($definitionAge -lt 48) {
Write-Output "Update successful - Definitions are current ($([math]::Round($definitionAge, 1)) hours old)"
exit 0
}
else {
Write-Output "Update may have failed - Definitions still outdated"
exit 1
}
}
catch {
Write-Error "Remediation failed: $_"
exit 1
}
# Copia sin cambios de https://github.com/ugurkocde/IntuneAutomation (commit 797bb2e).
# MIT License
#
# Copyright (c) 2025 Ugur Koc | Microsoft MVP
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.