note 43416 added to ref.com
| From: | martijn at lico dot nl | Date: | Sun, 20 Jun 2004 21:30:43 +0000 |
| Subject: | note 43416 added to ref.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71414@lists.php.net to get a copy of this message | ||
A nice feature you get with COM is the ability to connect to the Windows Management Instrumentation
(WMI for short). This allows you to monitor various system statistics (e.g. disk space en cpu usage)
of local and remote systems.
Small example:
<?php
$hostname = ".";
$wmi = new COM("WinMgmts:{impersonationLevel=impersonate}
//{$hostname}/root/cimv2");
$cpus = $wmi->ExecQuery("Select * from Win32_Processor");
foreach ($cpus as $cpu)
{
echo trim($cpu->Name)." {$cpu->MaxClockSpeed}MHz {$cpu->LoadPercentage}%\n";
}
?>
will give you this:
Intel Pentium III processor 860MHz 1%
Intel Pentium III processor 860MHz 2%
For more examples, see this post on my weblog: http://wiljedatikinjemond.com/article.php/2004061815294318
----
Manual Page -- http://www.php.net/manual/en/ref.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43416
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43416&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43416&report=yes
Search -- http://master.php.net/manage/user-notes.php