HEy,
i am trying to create script that produces an overview about the CPU-, RAM-, HDD- and Networkusage of a Server. At the end the results shall be converted to HTML. Furthermore the backgroundcolor has to change for different values for example 70% CPU yellow, 90% red and the rest green.
My problem is that the whole table is displayed in green at the moment.
Here's the snippet for the CPU-Usage
Set-Variable -name limitCPU70 -value 5,00 -option constant
Set-Variable -name limitCPU90 -value 15,0 -option constant
get-process | Sort-Object CPU | ConvertTo-Html -title "CPU Table" -property CPU, Name, Description | Foreach-Object { if ( $_.CPU -lt $limitCPU70) {$_ -replace "
", "
"} elseif ($_.CPU -ge $limitCPU70 -and $_.CPU -lt $limitCPU90) {$_ -replace "
", "
"} elseif ( $_.CPU -ge $limitCPU90) {$_ -replace "
", "
"} } | Out-File -filepath SKRIPTS:\CPU-Usage.html
How can i calculate percentages for example the empty space on a HDD or the 70% and 90% of the whole RAM and CPU? (limitCPU = $_.CPU *0.7??)
Thanks in advance
Greetz
|
|
|