此URL或KB ID(KB3139852)意义不大:https://support.microsoft.com/en-us/kb/3139852
但是,如果我们导航到URL,我们会看到更多的高级信息以及HF的含义:"MS16-034:Windows内核模式驱动程序的安全更新描述:2016年3月8日"
Get-Hotfix -ComputerName $server | Select HotfixID, Caption, InstalledOn | Where { $_.InstalledOn -gt (Get-Date).AddDays(-4) } | sort InstalledOn
即使我们使用PowerShell(仅使用Get-Hotfix
)运行,它也不会提供关于HotFix含义的太多细节。
我想我可以让PowerShell导航到Microsoft URL来提供我正在寻找的信息,但我认为它应该被标记为QuickFixEngineering的一部分?或者,我是不是走错了路?
谢谢!
我不确定你所说的"应该标记为QuickFixEngineering的一部分"是什么意思,但如果你想检索更新的标题,你可以使用Invoke-WebRequest
:
$ua = 'Googlebot/2.1 (+http://www.googlebot.com/bot.html)'
$uri = 'https://support.microsoft.com/en-us/kb/3139852'
$response = Invoke-WebRequest -Uri $uri -UserAgent $ua
$title = $response.AllElements.Where({$_.tagName -eq 'title'}).innerText
请注意,我必须模拟一个爬网程序才能实现这一点,因为默认情况下,Microsoft的页面似乎使用客户端javascript来填充元素,并且页面中没有可供解析的信息。
进行
Get-Hotfix
和
GWMI -Class Win32_QuickFixEngineering
会给你完全相同的结果。它返回cimv2\Win32_QuickFixEngineering中的数据集。
至于WMI扩展部分下的可用内容,您有以下
Name MemberType Definition
---- ---------- ----------
PSComputerName AliasProperty PSComputerName = __SERVER
Caption Property string Caption {get;set;}
CSName Property string CSName {get;set;}
Description Property string Description {get;set;}
FixComments Property string FixComments {get;set;}
HotFixID Property string HotFixID {get;set;}
InstallDate Property string InstallDate {get;set;}
InstalledBy Property string InstalledBy {get;set;}
Name Property string Name {get;set;}
ServicePackInEffect Property string ServicePackInEffect {get;set;}
Status Property string Status {get;set;}
__CLASS Property string __CLASS {get;set;}
__DERIVATION Property string[] __DERIVATION {get;set;}
__DYNASTY Property string __DYNASTY {get;set;}
__GENUS Property int __GENUS {get;set;}
__NAMESPACE Property string __NAMESPACE {get;set;}
__PATH Property string __PATH {get;set;}
__PROPERTY_COUNT Property int __PROPERTY_COUNT {get;set;}
__RELPATH Property string __RELPATH {get;set;}
__SERVER Property string __SERVER {get;set;}
__SUPERCLASS Property string __SUPERCLASS {get;set;}
PSStatus PropertySet PSStatus {__PATH, Status}
ConvertFromDateTime ScriptMethod System.Object ConvertFromDateTime();
ConvertToDateTime ScriptMethod System.Object ConvertToDateTime();
InstalledOn ScriptProperty System.Object InstalledOn {get=if ([environment]::osversion.version.build -ge ...
这并不能给你你想要的(除了"描述"属性给你的详细描述之外的详细描述)
不幸的是,由于https://support.microsoft.com/en-us/kb/3139852需要一些额外的凭据和代理管道,但没有用,还有另一种方法可以获取您的信息。
来源:
https://blogs.technet.microsoft.com/heyscriptingguy/2011/08/22/use-powershell-to-easily-find-information-about-hotfixes/
获取它的快捷方式是通过Win32_ReliabilityRecords类,然后根据源名称进行筛选。
$i = Get-WmiObject -Class Win32_ReliabilityRecords
$i = $i | where { $_.sourcename -match 'Microsoft-Windows-WindowsUpdateClient' }
$i.ProductName
# I broke it down into multiple operations to
# simplify for others
这会给你像这样的东西
Update for Microsoft Office 2010 (KB2965291) 32-Bit Edition
Update for Microsoft Filter Pack 2.0 (KB2881026) 32-Bit Edition
Update for Microsoft Visual Studio 2010 Tools for Office Runtime (KB3001652)
Update for Microsoft Outlook 2010 (KB3015585) 32-Bit Edition
Update for Microsoft Office 2010 (KB2956141) 32-Bit Edition
Update for Microsoft Visio Viewer 2010 (KB2881021) 32-Bit Edition
Update for Windows 7 for x64-based Systems (KB3006625)
希望这能有所帮助。