Hey guys!
How can i get some details about a windows process?, i need to know when the process started and his PID. Any thoughts?
I was thinking about using “Invoke Code” but i´m not sure if it can be done in that way.
Hey guys!
How can i get some details about a windows process?, i need to know when the process started and his PID. Any thoughts?
I was thinking about using “Invoke Code” but i´m not sure if it can be done in that way.
Hi @joaovictor ,
In an assign activity use the following expression.
Process_list = Process.GetProcesses
loop through the list and fetch the item details you want.
Process_list variable type is:-
Welcome to the UiPath community.
Just build a datatable with two columns, one for Process ID and one for start time.
You can use below LINQ query to get all the process running on the machine and their memory utilization as well.
(From processes In System.Diagnostics.Process.GetProcesses().AsEnumerable() _
Select processes).Select(
Function(x) dtProcesses.rows.Add({x.Id, x.StartTime})).
CopyToDataTable
This will return all the processes data in DataTable.
Thanks,
Ashok
Below code will help you you need to add in custom code
Find all processes with the specified name
Process[] processes = Process.GetProcessesByName(processName);
// Check if any processes were found
if (processes.Length == 0)
{
Console.WriteLine($"No process named '{processName}' found.");
return;
}
// Iterate through all matching processes
foreach (Process process in processes)
{
Console.WriteLine($"Process Name: {process.ProcessName}");
Console.WriteLine($"Process ID (PID): {process.Id}");
Console.WriteLine($"Start Time: {process.StartTime.ToString("yyyy-MM-dd HH:mm:ss")}"); // Formatted for readability
Console.WriteLine("--------------------------------");
}
Process.GetProcesses is a member of System.Diagnostics.Process not System.array
use this in your assign
System.Diagnostics.Process.GetProcesses
Alternatively you can import System.Diagnostics.Process in the imports section.
There is a built in activity to get all the current processes
From which you can filter what you need and get all the properties…to check the properties …say the processes are stored in variables abc
The. As it is an enumerable you need to loop using for loop to get all…or can use linq queries
And inaide the loop use currentitem.
To see the properties…it would have all propwrties that you need like pid etc
Cheers
It works
Thank you.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.