where –not

PowerShell v6.1 preview 2 has added the where –not option.

The option adds another parameter to the syntax

where-object <property name> <operator like parameter> <value>

Couple of examples of using the syntax

Get-Process | where CPU -gt 12

Get-Service | where Status -like ‘Stop*’

Use –Not  when you’re looking for properties that aren’t set. For example

Get-Service | where -Not DependentServices


Get-Process | where -Not StartTime

This entry was posted in PowerShell v6. Bookmark the permalink.

3 Responses to where –not

  1. cavallogolooso says:

    Sorry RIchard: for those of us that haven’t read everything: for the “everyday use” do you suggest PS 6 or PS 6.1 ? I mean to use it as scripting language for windows, as like as CMD.

  2. Tonyc says:

    Hi richard
    In trying to get my hands on hyperv in a month of lunches.. cant find it anywhere 😦
    Can you point my to a place I can buy it ?
    Thanks tony

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s