Script-based workflows often use WMI queries to pull in the necessary data. The best practice is that WMI queries should not use placeholders (i.e. “Select *”), and should instead be well-scoped and narrow in search.
WMI queries that use open-ended placeholders tend to pull in very large amounts of data, and then filter down from this. In a large instance space, this could potentially create a performance issues that could result of incomplete data and monitoring, and frequent script timeouts.
Using the Authoring Console:
1. For the Data Source modules for all workflows that use WMI-based scripts, ensure that the scripts that these modules are using do not contain placeholders.
Using XML:
BAD
Function KMSServiceDiscovery(ByRef Name, ByRef ProcessId, ByRef
State, ByRef DisplayName, ByRef PathName)
Dim sNamespace
sNamespace ="winmgmts://" & TargetComputer & "/root/cimv2"
Dim oKMSServices,
oService
Set oKMSServices =
WMIExecQuery(sNamespace, "SELECT * FROM Win32_Service WHERE Name ='sppsvc' OR Name = 'slsvc'")
if
oKMSServices.Count = 1 Then
For
Each oService in oKMSServices
Name
= oService.Name
ProcessId
= oService.ProcessId
State
= oService.State
DisplayName
= oService.DisplayName
PathName
= oService.PathName
Next
KMSServiceDiscovery
= True
Else
KMSServiceDiscovery
= False
End If
End Function
GOOD
Function KMSServiceDiscovery(ByRef Name, ByRef ProcessId, ByRef
State, ByRef DisplayName, ByRef PathName)
Dim sNamespace
sNamespace ="winmgmts://" & TargetComputer & "/root/cimv2"
Dim oKMSServices,
oService
Set oKMSServices =
WMIExecQuery(sNamespace, "SELECT Name, ProcessId, State,
DisplayName, PathName FROM Win32_Service WHERE Name = 'sppsvc' OR
Name = 'slsvc'")
if
oKMSServices.Count = 1 Then
For
Each oService in oKMSServices
Name
= oService.Name
ProcessId
= oService.ProcessId
State
= oService.State
DisplayName
= oService.DisplayName
PathName
= oService.PathName
Next
KMSServiceDiscovery
= True
Else
KMSServiceDiscovery
= False
End If
End Function