how to cast to decimal in where clause

I can’t seem to figure out how to cast $procs.CPUUtilization as a decimal type.

Thank you in advance

https://gist.github.com/Adminicrater/221e457f78fa491af0a13af6b45b08bd

A colleague helped me work this out I believe…

$cputhreshold = 0
$computers = "somePC"
$computers |
    ForEach-Object {
    $computer = $_
    Get-Counter "\\$computer\Processor(_Total)\% Processor Time" -SampleInterval 1 -MaxSamples 5 |
        Select -Expand CounterSamples |
        Select -Expand CookedValue |
        Measure-Object -Average |
        where { $_.Average -gt $cputhreshold } |
        Select @{n = 'ComputerName'  ; e = {$computer}},
               @{n = 'CPUUtilization'; e = {'{0:N2}' -f $_.Average}}
} | ConvertTo-HTML -fragment

You could do it in multiple ways.
I thought that .ToDecimal() should work pretty straight forward but it’s looking for an “iformatprovider”.

Anyway here are two ways that works for me (just pasting in the last portion of the code).

Where-Object {[convert]::ToDecimal($procs.CPUUtilization) -gt $cputhreshold}

Or

Where-Object {[decimal]"$($procs.CPUUtilization)" -gt $cputhreshold}