Call PowerCLI script from PHP


I want to build a small webinterface to grant our users certain permissions for handling linked clones.   On the webserver (Windows Datacenter 2008 R2 running IIS) I have installed PowerCLI. The website runs under my user-account (domain admin) to rule out any permission issues.

My PHP file looks like this:

$PowerCliCommand="C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Progra~2\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -file C:inetpublcmgmtlistlcs.ps1";  echo $PowerCliCommand . "
";  exec($PowerCliCommand