Exercise 3: The Export-Csv / Import-Csv Type Gotcha — Possible Solution ==================================================================== WHY THE COMPARISON MISBEHAVES ------------------------------ Per this chapter, CSV is plain text, and plain text has no concept of a number versus a string - every value that survives a round trip through Export-Csv and then Import-Csv comes back as a plain [string], even a column (like CPU) that started out as a real [double]. Comparing a re-imported CPU value with -gt 10 is therefore comparing a STRING against a number. While PowerShell's -gt operator can sometimes coerce a numeric-looking string for a simple comparison, relying on that silent coercion is exactly the kind of assumption this chapter's own $reloaded[0].CPU.GetType().Name example specifically warned against confirming rather than assuming - the safe habit is never to trust that a re-imported value is still the type it started as. THE FIX ------------------------------ Explicitly cast the re-imported value back to its real type before comparing, e.g. [double]$reloaded[0].CPU -gt 10, exactly as this chapter's own text recommends. This removes any dependence on implicit string-to-number coercion and guarantees the comparison is happening between two real numbers. WHY THIS WORKS AS AN ANSWER ------------------------------ It correctly explains that CSV round-tripping converts every value to a plain string regardless of its original type, correctly identifies the CPU comparison as a string being compared against a number, and correctly provides the explicit-cast fix this chapter itself recommends.