I have a (sample) php code as follows :
$name_Proc = "chrome.exe";
$wmi = new COM('winmgmts://');
$processes = $wmi->ExecQuery("SELECT * FROM Win32_Process WHERE Name ='".$name_Proc."'");
I used it to count the process with following code ,
$array = array();
foreach($processes as $process){
array_push($array,$process->ProcessId);
}
$count_Process = count($array);
return $count_Process;
Now, the real thing, i now need the process creation time, it is possible using VBScript with following code :
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'notepad.exe'")
For Each objProcess in colProcessList
Wscript.Echo objProcess.CreationDate
Next
Now, if i was wondering how would i implement this in my PHP script!
Any clues?
Ok, sorry everyone, just looked it now got it! I figured it out. Here’s the code, hope it might help someone in future 🙂
This piece of code is used, the complete code is as below:
Or simply use this :
Best,
Ahsan