I'm making a web page for the association I work for to check the daily data.
For each data in the array, there is a background-color that is green if the data exists and red if it's not the case. The data I'm looking for is located on severals servers I can access to thanks to PowerShell with the cmd powershell.exe Invoke-Command -Computer Server -ScriptBlock {Test-Path the_path_to_my_file}
, but when I make an exec function in php with this line in first argument and an array in second argument, the array remains empty.
I've tried this on my professional computer and it works but I have to log in to the server to access the data because I'm not administrator, but the web page is located on a server I administrate.
I know I can access the server with the cmd powershell.exe Invoke-Command -Computer Server -ScriptBlock {Test-Path the_path_to_my_file}
and the exec command works with an echo
for example.
I've also tried with passthru and SHell_Exec and there is no result either
function existe_srv($srv, $file){
exec("powershell.exe Invoke-Command -Computer ".$srv." -ScriptBlock {Test-Path \"".$file."\"}", $out );
if ($out[0] == True){return 'RGB(0,255,0)';}
else {return 'RGB(255,0,0)';}
}
background-color:
Notice: Undefined offset: 0 in D:\XAMP\htdocs\Test_opti_cartes\supervision_donnees_quotidiennes.php on line 37