PowerShell或QuickfixEngineering问题?

时间:2016-03-25 14:31:48

标签: powershell wmi

此网址或知识库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的一部分?或者,我是否采取了错误的方式?

谢谢!

2 个答案:

答案 0 :(得分:1)

我不确定你的意思"应该被标记为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来填充元素,并且在页面中没有可用于解析的信息

答案 1 :(得分:1)

Powershell中关于Get-Hotfix cmdlet的有趣之处在于它实际上只是从Win32_QuickFixEngineering中提取。所以是的,你已经部分正确地认为它应该被标记为QFE ......因为它是。

library(ggplot2)
ggplot(contour_data,aes(x,y,group=.id))+geom_path()

Get-Hotfix

会给你完全相同的结果。它返回cimv2 \ Win32_QuickFixEngineering的数据集。

至于WMI的这个未扩展部分可以获得的内容,您有以下内容

GWMI -Class Win32_QuickFixEngineering

哪些不能满足您的需求(除了'描述'属性提供的详细说明)

不幸的是,由于https://support.microsoft.com/en-us/kb/3139852需要一些额外的凭据和代理管道,我无法使用Invoke-WebRequest支持我的公司代理,但无济于事,还有另一种获取信息的方法。

来源:

https://blogs.technet.microsoft.com/heyscriptingguy/2011/08/22/use-powershell-to-easily-find-information-about-hotfixes/

获取它的快速纲要是通过Win32_ReliabilityRecords类,然后根据源名称进行过滤。

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 ...

这给你的东西像

$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

希望这会有所帮助。