-
Jul 16th, 2018, 10:09 AM
#1
Thread Starter
Member
CreateUpdateSearcher ResultCode fails
I'm running some code to check my servers for Windows Updates, and to see those which failed to install. (There are always some!)
The code runs fine, but I cannot get the resultcode to show. I get run-time error 438, and error message "Object does not support this property or method" when I reach the line that gets the resultcode:
Code:
Set objSearcher = objSession.CreateUpdateSearcher
Set objSearchResult = objSearcher.Search("IsAssigned=1 and IsInstalled=0 and IsHidden=0 and Type='Software'")
Dim colUpdates As New Collection
For x = 0 To objSearchResult.updates.Count - 1
colUpdates.Add objSearchResult.updates.item(x)
Next x
Command1.Enabled = False
sTimeDiff = DateDiff("s", start_time, Now)
s = sTimeDiff Mod 60
m = sTimeDiff \ 60
sTimeDiff = Format$(m, "00") & ":" & Format$(s, "00")
update_text ("Search completed at " & Time() & vbCrLf & "Elapsed time: " & sTimeDiff) & vbCrLf
DoEvents
pending_updates = 0
For Each item In colUpdates
With oXL.ActiveWorkbook.Sheets("Sheet1")
.Cells(current_row, 2) = operation$(item.DeploymentAction)
.Cells(current_row, 3) = item.msrcSeverity
.Cells(current_row, 4) = item.LastDeploymentChangeTime
.Cells(current_row, 5) = item.Title
.Cells(current_row, 6) = item.IsInstalled
.Cells(current_row, 7) = item.ResultCode
current_row = current_row + 1
pending_updates = pending_updates + 1
End With
Next
Checking the "item" via the watch window, I can see that .ResultCode does not exist, hence the error, but it must be in there, somewhere!
Does anyone know where I should be looking for this code?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|