Reading Registry on IIS server with PHP com object not working

464

I am trying to read a registry value on iis using the following script.

$shell = new COM("WScript.Shell") or die("Requires Windows Scripting Host");
$devenvpath=$shell->RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App\\Pathsfirefox.exe");

It doesn't work. It keeps telling me "Unable to open registry key". I am assuming this is a permissions issue but not sure. How can I get this to work.

Thanks for the help.

74

Answer

Solution:

Perhaps its only a typo on your original post, but it looks to me as though there ought to be a "\" between "Paths" and "Firefox.exe" in that registry line.

$devenvpath=$shell->RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App\\Paths\\firefox.exe");
513

Answer

Solution:

Finally got this working. I had to add the php extension for php_com_dotnet.dll. I did this inside php manager in IIS manager. Hope it helps someone else.

People are also looking for solutions to the problem: orm - PHP CodeIgniter returning Controller Name rather than Doctrine Associated Entity

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.