PHP, Win32, and COM Objects... Oh my..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
flakzeus
Forum Newbie
Posts: 1
Joined: Thu Jul 28, 2005 11:59 am

PHP, Win32, and COM Objects... Oh my..

Post by flakzeus »

I am trying to print out the list of sub-keys as you can see. However, when I run it, the PHP cli program crashes. Does anyone have any ideas as to what I've done wrong here?

Code:

Code: Select all

<?php
    $hostname = ".";
    $keyPath = "\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
    $wshShell = new COM("winmgmts:{impersonationLevel=impersonate}//{$hostname}/root/default:StdRegProv");
    $wshShell->EnumKey("HKEY_LOCAL_MACHINE", $keyPath, $keys);
    foreach($keys as $key){
        print $key;
    }
    unset($wshShell);
?>
Post Reply