What does the <code>Where-Object</code> cmdlet do in PowerShell?Where-Object filters objects from a collection based on a condition you specify. It only passes through objects that meet the condition.
Where-Object filter to get numbers greater than 10 from a list?Use: ... | Where-Object { $_ -gt 10 }. Here, $_ is the current item, and -gt means 'greater than'.
$_ represent inside the Where-Object script block?$_ is a variable that holds the current object being tested in the filter. Think of it as 'this item' in the list.
Where-Object filter based on object properties? Give an example.Yes. For example, to filter processes using more than 100MB memory: Get-Process | Where-Object { $_.WorkingSet -gt 100MB }.
Where-Object and ForEach-Object?Where-Object filters items based on a condition. ForEach-Object runs a command on each item but does not filter.
Where-Object { $_ -eq 5 } do?The condition $_ -eq 5 means 'equal to 5', so it selects only those objects.
Where-Object, what does $_ stand for?$_ is the current object being processed in the pipeline.
Where-Object?-gt means 'greater than'.
Where-Object?Length is the file size property, and -gt 1MB filters files larger than 1MB.
ForEach-Object runs commands on each object but does not filter.
Where-Object works to filter items in a PowerShell pipeline.Where-Object.