PHP Classes

Base WMI: Manage Windows resources with WMI objects

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 419 All time: 6,404 This week: 455Up
Version License PHP version Categories
basewmi 1.0GNU Lesser Genera...5.3PHP 5, Windows
Description 

Author

This package can manage Windows resources with WMI objects.

It provides a base class to create WMI objects, perform queries and returns the results.

The package also comes with separate classes to communicate with several WMI providers like CIMV2, SMS, Registry, etc..

Picture of Zsolt Munoz
Name: Zsolt Munoz <contact>
Classes: 6 packages by
Country: United States United States
Age: 44
All time rank: 758100 in United States United States
Week rank: 170 Up21 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Recommendations

Installed software and hardware using WMI
Retrieve the list of software and hardware installed on Windows

Example

<?php
   
/**
     * Usage Document for BaseWMI
     * Includes documentation for SMS/SCCM & WMI
     * Each Snippet of Code will work on its own but cannot run entire script below
     */
   
   
    /**********************SNIPPET**********************/
   
require_once("namespace.wmi.php");
   
    use \
WMI\WMLQuery as SimpleWML;
   
   
// Basic Usage of the SimpleWML
   
$SimpleWML = new SimpleWML('hostname','adminaccount','adminpassword','\root\CIMV2');
   
$SimpleWML->setWMIClass('Win32_BIOS');
   
$SimpleWML->setSelection('*');
   
$SimpleWML->setWhere('Manufacturer = "Dell Inc."');
   
$SimpleWML->select();
   
   
var_dump($SimpleWML->recordSet());
   
   
/**********************SNIPPET**********************/
   
require_once("namespace.wmi.php");
   
    use \
WMI\ObjQuery as SimpleWMI;
   
   
$SimpleWMI = new SimpleWMI('hostname','adminaccount','adminpassword','\root\CIMV2');
   
$objStartup = $SimpleWMI->setWMIClass('Win32_ProcessStartup');
   
$objConfig = $objStartup->SpawnInstance_;
   
$objConfig.ShowWindow = SW_NORMAL;
   
   
$objWin32Proc = $SimpleWMI->setWMIClass('Win32_Process');
   
$intWin32Proc = $objWin32Proc->Create("Notepad.exe", NULL, $objConfig, $intProcessID);
    if(
$intWin32Proc != 0) {
        echo
"Process could not be created.\n";
        echo
"Command: Notepad.exe\n";
        echo
"Return Value: " . $intWin32Proc;
    } else {
        echo
"Command: Notepad.exe\n";
        echo
"Process ID: " . $intProcessID;
    }
   
   
/**********************SNIPPET**********************/
   
require_once("namespace.wmi.php");
    require_once(
"CIMV2\SimpleCIMV2.php");
   
    use \
WMI\CIMV2\SimpleCIMV2 as SimpleCIMV2;
   
   
$SimpleCIMV2 = SimpleCIMV2::Connect('hostname','adminaccount','adminpassword');
   
   
var_dump($SimpleCIMV2->CIMV2Query('Win32_BIOS',array('Manufacturer'=>'Dell Inc.')));
   
var_dump($SimpleCIMV2->CIMV2ExposeMethods('Win32_Process'));
   
   
/**********************SNIPPET**********************/
   
require_once("namespace.wmi.php");
    require_once(
"SMS\SimpleSMS.php");
   
    use \
WMI\SMS\SimpleSMS as SimpleSMS;
   
   
$SimpleSMS = SimpleSMS::Connect('sccmserver','adminaccount','adminpassword','SM1');
   
$SimpleSMS->OmitFields('CollectionID','COLLROOT');
   
$SimpleSMS->OmitFields('Name','tst%');
   
$SimpleSMS->OmitFields('Name','sms%');
   
$SimpleSMS->OmitFields('Name','Uninstall%');
   
$SimpleSMS->OmitFields('CollectionID','SMS%');
   
$SimpleSMS->OmitFields('Comment','%HID%');
   
$arrSimpleSMS = $SimpleSMS->GetCollectionDetailsByName('Microsoft');
   
   
var_dump($arrSimpleSMS);
?>


  Files folder image Files (6)  
File Role Description
Files folder imageCIMV2 (1 file)
Files folder imageClientSMS (1 file)
Files folder imageSMS (1 file)
Files folder imageStdRegProv (1 file)
Plain text file namespace.wmi.php Class Master Namespace File
Accessible without login Plain text file usage.php Example Usage File

  Files folder image Files (6)  /  CIMV2  
File Role Description
  Plain text file SimpleCIMV2.php Class CIMV2 Namespace File

  Files folder image Files (6)  /  ClientSMS  
File Role Description
  Plain text file SimpleClientSMS.php Class SMS/SCCM Client Namespace File

  Files folder image Files (6)  /  SMS  
File Role Description
  Plain text file SimpleSMS.php Class SMS/SCCM Namespace File

  Files folder image Files (6)  /  StdRegProv  
File Role Description
  Plain text file SimpleRegistry.php Class StdRegProv Namespace File

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:419
This week:0
All time:6,404
This week:455Up