Configure the top processes by CPU and top processes by memory metrics for Microsoft
Endpoint Configuration Manager for Investigation.
Before you begin
Role required: sn_cimaf.sn_cimaf_admin
Procedure
-
Open the Microsoft Endpoint Configuration Manager.
-
Create a MECM script with the name GetProcess.
-
Provide the following code in the script block.
Param(
[Parameter(Mandatory=$True)]
[string]$orderBy,
[Parameter(Mandatory=$True)]
[string]$top
)
$processes = get-process
$Total = 0;
ForEach ($process in $processes) {
$Total += $process.cpu;
}
$processes | Sort-Object $orderBy -Descending | select processname,id,ws,cpu -First $top | select processname,id, @{l="mem"; e={$_.ws}}, @{l="cpu"; e={($_.cpu / $Total) * 100}};
-
Retrieve and copy the script GUID.
-
Open the MECM Adapter Configuration [sn_mecm_adapter_config] table.
The MECM Adapter Configuration table displays the list of adapter
configurations.
-
From the list of configurations, select and edit Running processes -
CPU%.
-
In the Action input field, add the script GUID.
-
Click Save.
-
From the list of configurations, select and edit Running processes -
MEM.
-
In the Action input field, add the script GUID.
-
Click Save.