I have some code that can read a key from the local registry.
$shell = new COM('WScript.Shell'); $data=$shell->regRead('HKEY_LOCAL_MACHINE\\SOFTWARE\\Symantec\\Symantec Endpoint Protection\\SMC\\ProductVersion');
How can I open another computer’s registry with this assuming that I have full access to that computer?
I’m getting an error using that code:
Uncaught exception ‘com_exception’ with message ‘Failed to create COM object `winmgmts:{impersonationLevel=impersonate}!\" & _strComputer & "\root\default:StdRegPro’
How else can I remotely connect to another computer’s registry? Thanks!
This is more of a WScript.Shell question than a PHP one, try here:
It should work the same, but I’ve never used the php COM component myself.
edit: in theory it should be:
$shell = new COM('winmgmts:{impersonationLevel=impersonate}!\\\\" & _ strComputer & "\\root\\default:StdRegPro');
Haven’t tried this myself though.