Windows 脚本宿主和快速修复工程
我想获取已安装的 Windows 修补程序和更新的列表。我使用下面的脚本:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
Set objDateTime = CreateObject("WbemScripting.SWbemDateTime")
For Each objQuickFix in colQuickFixes
Wscript.Echo "Computer: " & objQuickFix.CSName
Wscript.Echo "Description: " & objQuickFix.Description
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID
If Not (IsNull(objQuickFix.InstallDate) Or _
IsEmpty(objQuickFix.InstallDate)) Then
objDateTime.Value = objQuickFix.InstallDate
Wscript.Echo "Installation Date: " & objDateTime.GetFileTime
Else
WScript.Echo "Install Date Type: " &
TypeName(objQuickFix.InstallDate)
End If
Wscript.Echo "Installed By: " & objQuickFix.InstalledBy
Next
当我运行此脚本时,我收到错误消息:
Syntax error
Error Code 800A03EA
这段代码有什么问题?谢谢! 抱歉,如果我的英语不完美。
I want to get list of installed windows hotfix and updates. I use script below:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colQuickFixes = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
Set objDateTime = CreateObject("WbemScripting.SWbemDateTime")
For Each objQuickFix in colQuickFixes
Wscript.Echo "Computer: " & objQuickFix.CSName
Wscript.Echo "Description: " & objQuickFix.Description
Wscript.Echo "Hot Fix ID: " & objQuickFix.HotFixID
If Not (IsNull(objQuickFix.InstallDate) Or _
IsEmpty(objQuickFix.InstallDate)) Then
objDateTime.Value = objQuickFix.InstallDate
Wscript.Echo "Installation Date: " & objDateTime.GetFileTime
Else
WScript.Echo "Install Date Type: " &
TypeName(objQuickFix.InstallDate)
End If
Wscript.Echo "Installed By: " & objQuickFix.InstalledBy
Next
When I run this script I get Error message:
Syntax error
Error Code 800A03EA
What's wrong in this piece of code? Thanks!
Sorry if my English is not perfect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在这里缺少行继续符 (
_
):添加它或将代码放在单行中:
You are missing the line continuation character (
_
) here:Either add it or put the code in a singe line: