Performance of each process in the machine
```sh
$servername ="Machine1" # update Machine \hostname
gwmi Win32_PerfFormattedData_PerfProc_Process -filter "Name <> '_Total' and Name <> 'Idle'" -Computer $servername |
where { $_.PercentProcessorTime -gt 0 } |
select PSComputerName, Name, PercentProcessorTime |
sort PercentProcessorTime -Descending
```
CPU Utilization
```sh
$serverName ="Machine1" # update Machine \hostname
$ProcessorTime = (Get-WmiObject -ComputerName $serverName -Class win32_processor -ErrorAction Stop |
Measure-Object -Property LoadPercentage -Average |
Select-Object Average).Average
$ProcessorTime
```
Memory Utilization
```sh
$serverName ="Machine1" # update Machine \hostname
$ComputerMemory = Get-WmiObject -ComputerName $ServerName -Class win32_operatingsystem -ErrorAction Stop;
$MemoryUtilization = ((($ComputerMemory.TotalVisibleMemorySize - $ComputerMemory.FreePhysicalMemory)*100)/ $ComputerMemory.TotalVisibleMemorySize); $RoundMemory = [math]::Round($Memory, 2)
$MemoryUtilization
```
No comments:
Post a Comment