开发者

Windows Script Host & Quick Fix Engineering

开发者 https://www.devze.com 2023-01-20 20:59 出处:网络
I want to get list of installed windows hotfix and updates. I use script below: strComputer = \".\" Set objWMIService = GetObject(\"winmgmts:\" _

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.In开发者_如何学JAVAstallDate)
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.


You are missing the line continuation character (_) here:

''#                        -----------
''#                                  |
''#                                  \/

WScript.Echo "Install Date Type: " & _
TypeName(objQuickFix.InstallDate)

Either add it or put the code in a singe line:

WScript.Echo "Install Date Type: " & TypeName(objQuickFix.InstallDate)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号