|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-07-27 08:39 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2017-07-27 08:39 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 00:00:01 2025 UTC |
Description: ------------ Hi, I use the COM object of PHP to access to WMI Win32_PingStatus for create a remote ping. It's impossible to obtain the result of my request: My Error: com_exception Unable to lookup `statuscode': Unknown Name. Test script: --------------- My Class: class Windows { protected $servers; protected $username; protected $password; public function __construct($servers, $username, $password) { $this->servers = $servers; $this->username = $username; $this->password = $password; } protected function services($command) { $services = (new \COM ("WbemScripting.SWbemLocator"))->ConnectServer($this->servers, $command, $this->username, $this->password); $services->Security_->AuthenticationLevel = 3; $services->Security_->ImpersonationLevel = 3; return $services; } public function getHosts() { return $this->services('root\\cimv2') ->ExecQuery('Select * from Win32_ComputerSystem'); } public function GetPing($srv) { var_dump($srv); return $this->services('root\\cimv2') ->ExecQuery('select * from Win32_Pingstatus where Address='.$srv.''); } } And my View: $servername = '10.54.1.5'; $vmadress = new \Windows($servername, 'Ceicom-Cloud\Administrateur', 'Ceicom3333'); $pings = $vmadress->getPing('10.16.0.1'); foreach ($pings->statuscode as $ping) var_dump($ping); I have tested my class with my function getHosts and it's Ok ! Expected result: ---------------- If i user the PowerShell for Win32_PingStatus (With the same code) i have the return of statuscode...