我尝试用命令行实用程序更新Windows Defender。
"C:\Program Files\Windows Defender\MpCmdRun.exe" -SignatureUpdate结果是
Signature update started . . .
Signature update finished. No updates needed但是Windows显示有3个定义可用,它们可以与Windows客户端一起安装。
对于如何使用命令行客户端更新Defender,有任何提示吗?

发布于 2018-10-24 21:43:23
我现在用Powershell脚本来做这件事。虽然还不完美,但确实有效。
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Inquire'
$updateSession = New-Object -ComObject 'Microsoft.Update.Session'
$updateSession.ClientApplicationID = 'Defender Updates installer'
$updateSearcher = $updateSession.CreateUpdateSearcher()
'Searching for updates...'
$searchResults = $updateSearcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0")
if ( $searchResults.Updates.Count -eq 0 )
{
'There are no applicable updates.'
return
}
$updatesToDownload = New-Object -ComObject 'Microsoft.Update.UpdateColl'
for ( $i=0; $i -le $searchResults.Updates.Count - 1; $i++ )
{
$update = $searchResults.Updates.Item($i)
if ( $update.Title -like '*defender*' )
{
$update.AcceptEula()
$updatesToDownload.Add( $update )
}
}
if ( $updatesToDownload.Count -eq 0 )
{
'All applicable updates were skipped.'
return
}
'Downloading updates...'
$downloader = $updateSession.CreateUpdateDownloader()
$downloader.Updates = $updatesToDownload
$downloader.Download()
$updatesToInstall = New-Object -ComObject 'Microsoft.Update.UpdateColl'
'Successfully downloaded updates:'
for ( $i=0; $i -le $searchResults.Updates.Count - 1; $i++ )
{
$update = $searchResults.Updates.Item($i)
if ( $update.IsDownloaded -eq $true )
{
$updatesToInstall.Add( $update )
}
}
if ( $updatesToInstall.Count -eq 0 )
{
'No updates were successfully downloaded.'
return
}
'Installing updates...'
$installer = $updateSession.CreateUpdateInstaller()
$installer.Updates = $updatesToInstall
$installationResult = $installer.Install()
# Output results of install
'Installation Result: ' + $installationResult.ResultCode
'Reboot Required: ' + $installationResult.RebootRequired
'Listing of updates installed and individual installation results:'
for ( $i=0; $i -le $updatesToInstall.Count - 1; $i++ )
{
'> ' + $updatesToInstall.Item($i).Title + ': ' + $installationResult.GetUpdateResult($i).ResultCode
}https://serverfault.com/questions/916923
复制相似问题