how to get the output from vboxmanage list runningvms in PHP or Python
Posted: 25. Mar 2022, 17:15
When I call "vboxmanage list runningvms" I can't capture the output in PHP and echo the text.
I tried piping, redirecting, etc. and no luck.
Here is the code:
it returns nothing.
I also tried:
a.
but the txt file is empty
b.
it returns nothing
c.
Calling the version works
I get vbox version 6.0.24r139119 which is my test VM.
I don't know if this is STDOUT but I can't think of another way to capture the output of "list runningvms"
This is running on a Windows 7 with IIS 7. I cannot use Linux, I cannot use Apache and I cannot upgrade to Windows 10. If you find out that it works in other OSs it will make me jealous but it does not solve my problem so please focus on Windows 7 with IIS 7.
Let me know if there is another way to do this programmaticaly and send it to PHP. I could call Python and send to a text and read the text file in PHP. I will try this unless anyone here has a better way.
Thanks,
I tried piping, redirecting, etc. and no luck.
Here is the code:
Code: Select all
$output2=null;
$retvar=null;
echo "<h3>Check for running VMs</h3>";
$output2 = shell_exec("vboxmanage.exe list runningvms");
echo "<pre>$output2</pre>";I also tried:
a.
Code: Select all
$output2 = shell_exec("vboxmanage.exe list runningvms>runningvms.txt");b.
Code: Select all
$output2 = shell_exec("vboxmanage.exe list runningvms 2>&1");c.
Calling the version works
Code: Select all
$output2 = shell_exec("vboxmanage.exe --version");I don't know if this is STDOUT but I can't think of another way to capture the output of "list runningvms"
This is running on a Windows 7 with IIS 7. I cannot use Linux, I cannot use Apache and I cannot upgrade to Windows 10. If you find out that it works in other OSs it will make me jealous but it does not solve my problem so please focus on Windows 7 with IIS 7.
Let me know if there is another way to do this programmaticaly and send it to PHP. I could call Python and send to a text and read the text file in PHP. I will try this unless anyone here has a better way.
Thanks,