PS-Commands/Scripts/Get-CPUse.psm1
2023-12-19 00:06:14 +03:00

9 lines
No EOL
378 B
PowerShell

function Get-CPUse {
$CPU_Use_Proc = [string]((Get-CimInstance Win32_PerfFormattedData_PerfOS_Processor -ErrorAction Ignore |
Where-Object name -eq "_Total").PercentProcessorTime)+" %"
$CollectionCPU = New-Object System.Collections.Generic.List[System.Object]
$CollectionCPU.Add([PSCustomObject]@{
CPU = $CPU_Use_Proc
})
$CollectionCPU
}