用一个窗口列出所有的安装过的更新补丁,COM可以做到。不幸的是,它用起来不够爽,也不支持远程。
现在我们则例有一个Get-WindowsUpdate的函数,它能获取到本地已安装的默认更新,你也可以从指定电脑或同时从多个远程电脑获取这些更新数据。
通过Powershell的远程访问电脑,正常操作的前提是它的远程是被已打开的(例如WINDOWS SERVER2012默认打开PS远程管理),你只需要本地管理员权限在对方电脑上。
function Get-WindowsUpdate
{
  [CmdletBinding()]
  param
  (
    [String[]]
    $ComputerName,
    $Title = '*',
    $Description = '*',
    $Operation = '*'
  )
  
  $code = {
    param
    (
      $Title,
      $Description
    )
    $Type = @{
      name='Operation'
      expression={
    
    switch($_.operation)
    {
            1 {'Installed'}
            2 {'Uninstalled'}
            3 {'Other'}
    }
 }
}
    
    
    $Session = New-Object -ComObject 'Microsoft.Update.Session'
    $Searcher = $Session.CreateUpdateSearcher()
    $historyCount = $Searcher.GetTotalHistoryCount()
    $Searcher.QueryHistory(0, $historyCount) | 
    Select-Object Title, Description, Date, $Type |
    Where-Object { $_.Title -like $Title } |
    Where-Object { $_.Description -like $Description } |
    Where-Object { $_.Operation -like $Operation }
  }
  $null = $PSBoundParameters.Remove('Title')
  $null = $PSBoundParameters.Remove('Description')
  $null = $PSBoundParameters.Remove('Operation')
  Invoke-Command -ScriptBlock $code @PSBoundParameters -ArgumentList $Title, $Description
}
这个函数也支持筛选功能,如此我们只想得到已安装的OFFICE更新,只需这样做:
本文链接: https://www.pstips.net/checking-windows-updates.html
请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!
                                      请尊重原作者和编辑的辛勤劳动,欢迎转载,并注明出处!


想问问这个和get-hotfix有什么区别啊?
我自己的机器上hotfix的个数是:21,windows update的个数是62。windows update 包含了hotfix。系统的常规更新算是update,针对客户或者黑客报的一些bug做出的修复为hotfix。
WIN8系统不好用,想撤回WIN7!WIN7有办法用PS4.0吗?
win7 打了sp1补丁以后,是可以安装ps4.0的。
Windows6.1-KB2819745-x64-MultiPkg.msuwin7下的内建Module少多啦!
同感,win7下的ps4.0是少了很多module。