This is currently under heavy development and no release candidate has be marked at this point. You are free to use this in production with relatively low-risk as the library itself is fully functional, and is READ-ONLY so there should be no side-effects from its usage.
composer require phpwintools/wmi-scripting
Basic usage is to call ::query($connection = null)
on an available model from
https://github.com/phpwintools/wmi-scripting/tree/master/src/WmiScripting/Models.
PhpWinTools\WmiScripting\Models\LoggedOnUser::query()->get();
This returns a collection of logged on users from the default connection (this is local by configuration).
The ModelCollection
extends https://github.com/tightenco/collect / Laravel Collections.
You can also instantiate Scripting
:
$scripting = new PhpWinTools\WmiScripting\Scripting;
$scripting->addConnection('remote', PhpWinTools\WmiScripting\Connection::simple('server', 'user', 'password'));
$scripting->query('remote')->loggedOnUser()->get();
Whether you use $scripting->query($connection = null)->modelName()
or ::query($connection = null)
you are dropped into a basic query
builder which currently only allows select
and where
clauses. If there are any subject matter experts who would like
to guide me on how this query builder should look please contact me.
This is still an area that is under development.
You can call Scripting::fake($testCase)->win32Model($class_name);
to create a fake for testing without
actually creating a real connection to a WMI service.