Windows Management Instrumentation Query Language (WQL) and PHP?
| From: | Andrew M. Johnstone | Date: | Wed, 01 Sep 2004 05:11:50 +0000 |
| Subject: | Windows Management Instrumentation Query Language (WQL) and PHP? | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-1244@lists.php.net to get a copy of this message | ||
Hello,
I'm trying to figure out how to run a WQL Query using PHP5's Com,
however i'm struggling to get this working, any ideas...
<?php
/**
HRESULT ExecQuery(
const BSTR strQueryLanguage,
const BSTR strQuery,
LONG lFlags,
IWbemContext* pCtx,
IEnumWbemClassObject** ppEnum
);
*/
$domainObject = new COM("winmgmts://./root/cimv2");
/**
* com_exception: 'Unable to lookup `%s': Unknown name.
* print $domainObject->Name;
* print $domainObject->ADsPath;
* print $domainObject->Class;
* print $domainObject->GUID;
* print $domainObject->Parent;
* print $domainObject->Schema;
*/
/**
* com_exception: SWbemServicesEx
* echo $domainObject->ExecQuery('');
*/
//com_exception: 'Parameter 1: Type mismatch.'
//echo $domainObject->ExecQuery('WQL',"Select * from Win32_Service
where Name Like '%ADAM_%'", 'WBEM_FLAG_RETURN_IMMEDIATELY', null);
//com_exception: 'Parameter 0: Type mismatch.'
echo $domainObject->ExecQuery("Select * from Win32_Service where Name
Like '%ADAM_%'",'WQL', 'WBEM_FLAG_RETURN_IMMEDIATELY');
?>
Any help is much appreciated, thanks:)
Best Regards,
Andrew Johnstone
www.ajohnstone.com