PS-Commands/Scripts/Get-CPUse.psm1

9 lines
378 B
PowerShell
Raw Normal View History

2023-12-19 00:06:14 +03:00
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
}