php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30060 Fatal Error is reported when calling winmgmt COM object
Submitted: 2004-09-10 23:49 UTC Modified: 2004-09-28 23:19 UTC
Votes:6
Avg. Score:4.2 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: Michael dot Rivera at Ceridian dot com Assigned:
Status: No Feedback Package: COM related
PHP Version: 5.0.1 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Michael dot Rivera at Ceridian dot com
New email:
PHP Version: OS:

 

 [2004-09-10 23:49 UTC] Michael dot Rivera at Ceridian dot com
Description:
------------
When trying to call the com object winmgmt I get the following error.

Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `winmgmts://./root/cimv2': ' in C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0 {main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on line 4


Reproduce code:
---------------
<?php
$hostname = ".";
//com_print_typeinfo ("winmgmts://./root/cimv2");
$wmi = new COM("winmgmts://./root/cimv2");


  $names = $wmi->ExecQuery("Select Name, Manufacturer, Model, NumberOfProcessors, TotalPhysicalMemory 
  from Win32_ComputerSystem");
  foreach ($names as $system)
  {
   echo trim($system->Name).'<br>Manufacturer: '.($system->Manufacturer).
    '<br> Model: '.($system->Model).'<br> Number of Processors:'.($system->NumberOfProcessors).
	'<br> Physical Memory: '.(($system->TotalPhysicalMemory/1024)/1024).' Mg';
  }
?>

Expected result:
----------------
The manufacturer, the number of procesors and amount of physical memory on the server that this is run on.

Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `winmgmts://./root/cimv2': ' in C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0 {main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on line 4


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-11 02:59 UTC] pollita@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

winmgmts://./root/cimv2 is not a valid com object name so COM couldn't instantiate it, therefore it threw an exception.

You didn't catch the exception and all uncaught exceptions are fatal.
 [2004-09-11 10:45 UTC] wez@php.net
Check this out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/constructing_a_moniker_string.asp

Someone recently reported to me that they needed to set the impersonation level, as shown towards the end of that page.
 [2004-09-28 23:19 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Nov 28 05:03:12 2021 UTC