public class WMIClient extends QueryClient
WMIClient provides services for executing queries on WMI databases and the Windows registry.
Use this class for protocols whose name is com.hp.ucmdb.discovery.library.clients.ClientsConsts.WMI_PROTOCOL_NAME.
AgentConstants.PROP_WMI_NAMESPACE. If not set, the default root\\cimv2 is used.
# The method that prepares client for query and calls getRegValues method for execution
def DiscoveryMain(Framework):
props = Properties()
props.setProperty(AgentConstants.PROP_WMI_NAMESPACE, 'root\\DEFAULT')
wmiClient = Framework.getClientFactory().createClient(props)
keypath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
filter = 'DisplayName'
names = getRegValues(wmiClient, keypath, filter)
# This method executes and processes the result
def getRegValues(wmiClient, keypath, filter):
result = {}
table = wmiClient.getRegistryKeyValues(keypath, 1, filter)
keys = table.get(0)
values = table.get(1)
for i in range(keys.size()):
key = keys.get(i)
end = key.find('\\' + filter)
key = key[0:end]
result.update({key : values.get(i)})
return result
QueryClientBaseClient.FilteredMethodsHandlerCREDENTIALS_ID, ENCODING| Constructor and Description |
|---|
WMIClient(ClientsFrameworkImpl framework,
java.util.Properties props) |
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList |
getRegistryKeyValues(java.lang.String keypath,
boolean bUseFilter,
java.lang.String filter)
Returns values from the HKEY_LOCAL_MACHINE tree of the Windows registry.
|
java.util.ArrayList |
getRegistryKeyValues(java.lang.String HKEY,
java.lang.String keypath,
boolean bUseFilter,
java.lang.String filter)
Returns values from the specified tree of the Windows registry.
|
executeQueryaddDeniedPackage, close, getClientType, getCredentialId, getIpAddress, getProperty, getShellCmdSeperator, getSudoCommands, getSudoPaths, getTimeout, getUserName, isConnected, setAttributeEncrypted, supportsSudopublic WMIClient(ClientsFrameworkImpl framework,
java.util.Properties props)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.ArrayList getRegistryKeyValues(java.lang.String keypath,
boolean bUseFilter,
java.lang.String filter)
throws java.lang.Exception
keypath - The relative path under HKEYbUseFilter - If true, only filtered attributes are returnedfilter - Specifies which fields will be returnedjava.lang.Exceptionpublic java.util.ArrayList getRegistryKeyValues(java.lang.String HKEY,
java.lang.String keypath,
boolean bUseFilter,
java.lang.String filter)
throws java.lang.Exception
HKEY - The registry root from which to return valueskeypath - The relative path under HKEYbUseFilter - If true, only filtered attributes are returnedfilter - Specifies which fields will be returnedjava.lang.ExceptionDocumentation Feedback
Copyright 2012 Micro Focus or one of its affiliates.