-
Book Overview & Buying
-
Table Of Contents
PowerShell 7 Workshop
By :
We can filter objects in a more sophisticated way using the Where-Object cmdlet. Where-Object also looks at the properties of the objects in the pipeline, but it can also make decisions about which objects to output and which to discard. Try this:
Get-Process | Where-Object -Property CPU -gt -Value 1
This will return a list of processes where the CPU property has a value greater than 1. In practice, we very rarely see people include the -Property and -Value names for the parameters, as they are positional. It is far more likely that you will see this written as follows:
Get-Process | where CPU -gt 1
Wait, though. What’s that -gt? The -gt parameter is a comparison operator, an important concept in coding.
Comparison operators are expressed as switch parameters when using the Where-Object cmdlet, resulting in the help file being a long and complex document, with many parameter sets, as only one comparison operator...
Change the font size
Change margin width
Change background colour