我试过PowerShell的Get-Hotfix
,不喜欢结果。我不需要安装任何新的更新。我想以CSV格式获得结果,因为我有大约30台服务器要列出。使用Powershell已安装的MSKB补丁更新清单
这是我到目前为止有:
$servern = 'ABC'
$Session = [activator]::CreateInstance([type]::GetTypeFromProgID("Microsoft.Update.Session",$servern))
$Searcher = $Session.CreateUpdateSearcher()
$HistoryCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(1, $historyCount) | Select-Object Date,$servern,
$temp = "" | Select Computer, operation, resultcode,resultcode
$temp.Computer = $servern,
$temp.operation = expression={switch($_.operation){
1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}}},
$temp.resultcode = expression={switch($_.resultcode){
1 {"In Progress"}; 2 {"Succeeded"}; 3 {"Succeeded With Errors"};
4 {"Failed"}; 5 {"Aborted"}
}}
$temp.Title
# What we would like to see is:
# SERVER, DATE, TITLE, OPERATION, RESULTCODE
# ABC,5/5/2011 3:29:52 PM,Update for Windows Server 2003 (KB927891),Installation,Succeeded
# ABC,5/5/2011 3:30:01 PM,Cumulative Security Update for Outlook Express for Windows Server 2003 (KB929123),Installation,Succeeded
# etc..
并将这些信息导致CSV。
谢谢!
这不是你一个答案,但您使用WSUS?如果是这样,您可以使用WSUS 4/PowerShell 3中提供的WSUS cmdlet吗?通过这种方式,WSUS将为您保留所有这些信息,并且您可以在中心位置进行查询。 – briantist 2014-10-31 16:36:49
我不知道它是WSUS还是Shavlik?我们的服务器更新由与我们不同的团队管理。我们正在独立地尝试捕获安装的服务器/补丁的日志或列表,然后与补丁团队联系。 – Leptonator 2014-10-31 16:43:54