PHP Classes

Windows PHP WMI Class: Query local and remote Windows systems with WMI

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 51%Total: 443 All time: 6,215 This week: 119Up
Version License PHP version Categories
wmi 1.0.0BSD License5.5PHP 5, System information, Windows, C...


This package can query local and remote Windows systems with WMI.

It uses COM objects to query the local Windows system or connect and send queries to a given remote Windows system.

The class returns the query results as arrays.


Get disabled users and mobile number of users
List of disabled users and users' mobile number

Picture of Christian Vigh
  Performance   Level  
Name: Christian Vigh <contact>
Classes: 32 packages by
Country: France France
Age: 57
All time rank: 13810 in France France
Week rank: 10 Up1 in France France Up
Innovation award
Innovation award
Nominee: 20x

Winner: 3x



        The following example shows how to use the WMI class to query system information using the Windows
        Management Interface.

require ( 'Wmi.phpclass' ) ;

    if (
php_sapi_name ( ) != 'cli' )
        echo (
"<pre>" ) ;

// Create an object for accessing the Windows Management Interface
$wmi = new Wmi ( ) ;

// Display the list of processes currently running on your system (pid + command line).
    // (for more information about the Win32_Process WMI class, see :
echo ( "Process list :\n" ) ;
$process_list = $wmi -> QueryInstances ( 'Win32_Process' ) ;

    foreach (
$process_list as $process )
        echo (
"\tProcess : ({$process -> ProcessId}) {$process [ 'CommandLine' ]}\n" ) ;

// Display the list of printers configured on your system
    // (for more information about the Win32_Printer WMI class, see :
echo ( "\n\nPrinter list :\n" ) ;
$printer_list = $wmi -> QueryInstances ( 'Win32_Printer' ) ;

    foreach (
$printer_list as $printer )
        echo (
"\t{$printer -> Caption}\n" ) ;

// Display all the logical drives defined on your system
    // (for more information about the Win32_LogicalDrive WMI class, see :
echo ( "\n\nLogical drives :\n" ) ;
$logical_drives = $wmi -> QueryInstances ( 'Win32_LogicalDisk' ) ;

    foreach (
$logical_drives as $drive )
        echo (
"\t{$drive -> Name} ({$drive -> VolumeName})\n" ) ;

// Display removable logical drives list, using the Query() method with a WHERE clause instead of calling QueryInstances()
echo ( "\n\nRemovable logical drives :\n" ) ;
$logical_drives = $wmi -> Query ( 'SELECT * FROM Win32_LogicalDisk WHERE MediaType = 11' ) ;

    foreach (
$logical_drives as $drive )
        echo (
"\t{$drive -> Name}\n" ) ;

  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file Doc. Documentation
Plain text file Wmi.phpclass Class Class source

 Version Control Reuses Unique User Downloads Download Rankings  
This week:0
All time:6,215
This week:119Up
 User Ratings  
 All time