StumpedTechy
MIS
Okay I don't get this - I am playing around with this WMI querying as I have only done VERY small simple single queries. I usually do like the below and then find the item I need and modify it and not worry about the other values. This time however I need it to report back if this value is there or not. I am not sure how to get this to not do this for each patch -
The problem is the Query returning all hotfixes and doing the for each statement applies it to each hotfix when this machine and most of them have a ton. My question is how do I modify this portion of the script to return only 1 single KB I am looking for?
I thought I could modify the query. I tried to do something like -
But this failed miserably. I don't think I know enough about the Select * line to be able to make a decient query if in fact this is even able to be modified.
Basically instead of having ALL of the items Win32_QuickFixEngineering returned I need a Single item to be verified. And then reported on if its there or not.
Maybe I need to change For Each objHotfix in colHotfix
to For Each (objHotfix.ServicePackInEffect) = "KB928388" in colHotfix?
If anyone can point me to this I know I am ALMOST there I just can't quite see the forest for the trees.
Code:
Set colHotfix = objWMIService.ExecQuery _
("Select * from Win32_QuickFixEngineering")
For Each objHotfix in colHotfix
If (objHotfix.ServicePackInEffect) = "KB928388" then
msg = "Hotfix Installed"
msgbox msg
Else
msg = "Hotfix Not Installed"
msgbox msg
End if
The problem is the Query returning all hotfixes and doing the for each statement applies it to each hotfix when this machine and most of them have a ton. My question is how do I modify this portion of the script to return only 1 single KB I am looking for?
I thought I could modify the query. I tried to do something like -
Code:
Set colHotfix = objWMIService.ExecQuery _
("Select ServicePackInEffect from Win32_QuickFixEngineering WHERE ServicePackInEffect = KB928388")
For Each objHotfix in colHotfix
If (objHotfix.ServicePackInEffect) = "KB928388" then
msg = "Hotfix Installed"
msgbox msg
Else
msg = "Hotfix Not Installed"
msgbox msg
End if
But this failed miserably. I don't think I know enough about the Select * line to be able to make a decient query if in fact this is even able to be modified.
Basically instead of having ALL of the items Win32_QuickFixEngineering returned I need a Single item to be verified. And then reported on if its there or not.
Maybe I need to change For Each objHotfix in colHotfix
to For Each (objHotfix.ServicePackInEffect) = "KB928388" in colHotfix?
If anyone can point me to this I know I am ALMOST there I just can't quite see the forest for the trees.