|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-24 14:07 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 18:00:01 2025 UTC |
Description: ------------ Hi, i am trying to warite a php script for administration of microsoft virtual server when i use a COM "VirtualServer.Application" the object is created but when i tried to access "VirtualMachines" etc,the COM function will troughs error. Reproduce code: --------------- vb script:- 'Script Begins On Error Resume Next 'Connect to Virtual Server Set virtualServer = CreateObject("VirtualServer.Application") 'Get collection of virtual machines set vmCollection = virtualServer.VirtualMachines 'Iterate over the virtual machines and display data For Each vm in vmCollection Wscript.Echo "==============================" Wscript.Echo "Name: " & vm.Name Wscript.Echo Wscript.Echo "Notes: " & vm.Notes Wscript.Echo "==============================" Next 'Script Ends Works Fine PHP Script <?php f1(); function f1() { //Connect to Virtual Server $virtualServer = new COM("VirtualServer.Application"); //Get collection of virtual machines $vmCollection = $virtualServer->VirtualMachines; //Iterate over the virtual machines and display data foreach( $vmCollection as $vm) { print("\n=============================="); print( "\nName: " $vm->Name); print("\n=============================="); } } Expected result: ---------------- The Virtual Server objected created Actual result: -------------- Throughs Run time ERROR: Fatal error: Uncaught exception 'com_exception' with message 'Source: Unknown Description: Unknown' in C:\Program Files\lxlabs\ext\php\test.php:9 Stack trace: #0 C:\Program Files\lxlabs\ext\php\test.php(9): f1() #1 C:\Program Files\lxlabs\ext\php\test.php(2): f1() #2 {main} thrown in C:\Program Files\lxlabs\ext\php\test.php on line 9 When i cought Exception it will tough Object #2 please help me it's urgent