PHPackages                             oriceon/wmi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. oriceon/wmi

ActiveLibrary

oriceon/wmi
===========

A package for WMI manipulation using PHP and COM.

1.0.1(1y ago)05MITPHPPHP &gt;=5.4.0

Since Feb 26Pushed 1y ago1 watchersCompare

[ Source](https://github.com/oriceon/wmi)[ Packagist](https://packagist.org/packages/oriceon/wmi)[ RSS](/packages/oriceon-wmi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

WMI - Windows Management Instrumentation in PHP
-----------------------------------------------

[](#wmi---windows-management-instrumentation-in-php)

[![Travis CI](https://camo.githubusercontent.com/ac4a1b297dc4db7c4ff72397fec37d27929ca43265f291820b4006cd5e52f2e5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f726963656f6e2f776d692e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/oriceon/wmi)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c5046548320a185c0c876afeb938ff1f086ca802e7e4e567b1bb75c2ab1b9c2f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6f726963656f6e2f776d692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/oriceon/wmi/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/b143ca8ce141c6d46f30164f0314e7096572943de36157b65c186930f3d2f2e4/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f65623732643366642d373436342d343166312d393238622d6265373734656239653639372e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/eb72d3fd-7464-41f1-928b-be774eb9e697)[![Latest Stable Version](https://camo.githubusercontent.com/8e70e5cb7f2520199d62d6fea8dc14de1b191023d989b9f352f4a454bf4dad76/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f726963656f6e2f776d692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/oriceon/wmi)

### Requirements

[](#requirements)

To use WMI, your server must meet the following requirements:

- Windows OS
- PHP 5.4 or Greater
- PHP COM extension enabled

### Installation

[](#installation)

Insert WMI into your `composer.json`:

```
"oriceon/wmi": "^1.0"

```

Now run `composer update`.

You're all set!

Usage
-----

[](#usage)

### Connecting

[](#connecting)

To use WMI, you must create a new WMI instance. To interact with the current computer, just create a WMI instance:

```
use Oriceon\Wmi\Wmi;

$wmi = new Wmi();

```

To interact with a PC on your network, you'll need to enter a host name, and a username and password if needed:

```
$wmi = new Wmi($host = 'GUEST-PC', $username = 'guest', $password = 'password');

```

Now we can connect to it, but you'll need to specify the namespace you're looking to connect to:

```
$wmi->connect('root\\cimv2');

```

The `connect()` method will return true or false if the connection was successful:

```
if ($connection = $wmi->connect('root\\cimv2'))
{
    echo "Cool! We're connected.";

    $query = $connection->newQuery();
}
else {
    echo "Uh oh, looks like we couldn't connect.";
}

```

### Querying

[](#querying)

> **CAUTION**: Before we get started with queries, you should know that **NO VALUES** are escaped besides quotes inside any query method. This package **is not** meant to handle user input, and you should not allow users to query computers on your network.

#### Raw Queries

[](#raw-queries)

Once you've connected to the computer, you can execute queries on it with its connection. To execute a raw query, use:

```
$connection = $wmi->getConnection();

$results = $connection->query('SELECT * FROM Win32_LogicalDisk');

foreach($results as $disk)
{
    $disk->Size;
}

```

#### Query Builder

[](#query-builder)

WMI Comes with a WQL query builder so you're able to easily build statements. To create a new Builder use the `newQuery()`method on the WMI connection instance like so:

```
$query = $wmi->getConnection()->newQuery();

```

Once you have the query, we can start building:

```
$results = $query->select('*')
    ->from('Win32_LogicalDisk')
    ->where('Size', '>=', '150000')
    ->get();

```

##### Select

[](#select)

The select method accepts a string or an array to insert selects onto the current query. For example:

```
// Select All
$query->select('*');

// Select Specific
$query->select(['Name', 'Disk', 'Size']);

// Select Specific (string)
$query->select('Name, Disk, Size');

```

If you don't use the select method, that's fine too. The Builder will assume you're meaning to select all columns, so you're able to perform:

```
$query->from('Win32_LogicalDisk')->get();

// Query Executed
SELECT * FROM Win32_LogicalDisk

```

##### From

[](#from)

The from method accepts a string that is a WMI class name. For example:

```
$query->from('Win32_DiskDrive')->get();

// Or

$query->from('Win32_BIOS')->get();

```

For more information on WMI classes, visit:

##### Where

[](#where)

The where method accepts a field, operator and value. This is useful for retrieving data with a specific set of requirements.

The method:

```
$query->where($field, $operator, $value);

```

Example:

```
$query->where('Size', '>', 15000)->from('Win32_LogicalDisk')->get();

```

The field parameter needs to be an attribute in the `from` class, otherwise you will not receive the correct results.

Original code fwork from: `stevebauman/wmi`

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance43

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

446d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a9692bf91992f959404944cecec65e1b68b21491ec3c5642e67e47a836d9ea8?d=identicon)[oriceon](/maintainers/oriceon)

---

Top Contributors

[![oriceon](https://avatars.githubusercontent.com/u/358823?v=4)](https://github.com/oriceon "oriceon (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oriceon-wmi/health.svg)

```
[![Health](https://phpackages.com/badges/oriceon-wmi/health.svg)](https://phpackages.com/packages/oriceon-wmi)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
