windows

A collection of 35 posts
powershell

Powershell 操作 windows更新

定义更新搜索 $Criteria = "IsInstalled=0 and Type='Software'" 搜索可用的更新 $Searcher = New-Object -ComObject Microsoft.Update.Searcher $SearchResult = $Searcher.Search($Criteria).Updates 下载更新 $Session = New-Object -ComObject Microsoft.Update.Session $Downloader = $Session.CreateUpdateDownloader() $Downloader.Updates = $SearchResult $Downloader.Download() 安装更新 $Installer = New-Object -ComObject Microsoft.Update.Installer $Installer.Updates = $SearchResult $Result = $Installer.Install() 检查是否需要重启 $Resu
1 min read