-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
...Performance Degraded Test/Check CPU Performance Report top 5 processes and percentage.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
"%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" -noprofile -command "& {$CPUTotalErrorThreshold=70;[int]$hour = get-date -format HH;If($hour -lt 8 -or $hour -gt 17){$InBusinessHours = $false}Else{$InBusinessHours = $true};$CpuCores = (Get-WMIObject Win32_ComputerSystem).NumberOfLogicalProcessors;$CPUValues = (Get-Counter \"\Process(*)\% Processor Time\" -ErrorAction SilentlyContinue).CounterSamples | Select InstanceName, @{Name=\"CPU\";Expression={[Decimal]::Round(($_.CookedValue / $CpuCores), 2)}} | where-object {($_.InstanceName -ne '_total') -and ($_.InstanceName -ne 'idle')} | sort cpu -Descending | select -First 5;$Total = ($CPUValues | Measure-Object 'CPU' -Sum).Sum;$ErrorNames = ($CPUValues | Select -ExpandProperty InstanceName) -join ',';$ErrorValues = ($CPUValues | Select -ExpandProperty CPU) -join ',';if (($total -gt $CPUTotalErrorThreshold) -and ($InBusinessHours)){Write-Output \"Error Top Processes Are $ErrorNames that uses $ErrorValues % respectively\"}Else{Write-Output \"$Total % - CPU Healthy\"}; }" | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|