Export (0) Print
Expand All

Where-Object

Updated: August 9, 2015

Where-Object

Selects objects from a collection based on their property values.

Aliases

The following abbreviations are aliases for this cmdlet: 

  • where, ?

Syntax

Parameter Set: EqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] [-EQ] [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveContainsSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CContains [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CEQ [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveGreaterOrEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CGE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveGreaterThanSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CGT [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveInSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CIn [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveLessOrEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CLE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveLessThanSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CLT [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveLikeSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CLike [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveMatchSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CMatch [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveNotContainsSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CNotContains [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveNotEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CNE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveNotInSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CNotIn [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveNotLikeSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CNotLike [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: CaseSensitiveNotMatchSet
Where-Object [-Property] <String> [[-Value] <Object> ] -CNotMatch [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: ContainsSet
Where-Object [-Property] <String> [[-Value] <Object> ] -Contains [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: GreaterOrEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -GE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: GreaterThanSet
Where-Object [-Property] <String> [[-Value] <Object> ] -GT [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: InSet
Where-Object [-Property] <String> [[-Value] <Object> ] -In [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: IsNotSet
Where-Object [-Property] <String> [[-Value] <Object> ] -IsNot [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: IsSet
Where-Object [-Property] <String> [[-Value] <Object> ] -Is [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: LessOrEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -LE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: LessThanSet
Where-Object [-Property] <String> [[-Value] <Object> ] -LT [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: LikeSet
Where-Object [-Property] <String> [[-Value] <Object> ] -Like [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: MatchSet
Where-Object [-Property] <String> [[-Value] <Object> ] -Match [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: NotContainsSet
Where-Object [-Property] <String> [[-Value] <Object> ] -NotContains [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: NotEqualSet
Where-Object [-Property] <String> [[-Value] <Object> ] -NE [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: NotInSet
Where-Object [-Property] <String> [[-Value] <Object> ] -NotIn [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: NotLikeSet
Where-Object [-Property] <String> [[-Value] <Object> ] -NotLike [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: NotMatchSet
Where-Object [-Property] <String> [[-Value] <Object> ] -NotMatch [-InputObject <PSObject> ] [ <CommonParameters>]

Parameter Set: ScriptBlockSet
Where-Object [-FilterScript] <ScriptBlock> [-InputObject <PSObject> ] [ <CommonParameters>]




Detailed Description

The Where-Object cmdlet selects objects that have particular property values from the collection of objects that are passed to it. For example, you can use the Where-Object cmdlet to select files that were created after a certain date, events with a particular ID, or computers that use a particular version of Windows.

Starting in Windows PowerShell 3.0, there are two different ways to construct a Where-Object command.

Script block. You can use a script block to specify the property name, a comparison operator, and a property value. Where-Object returns all objects for which the script block statement is true.

For example, the following command gets processes in the Normal priority class, that is, processes where the value of the PriorityClass property equals Normal.

Get-Process | Where-Object {$_.PriorityClass -eq "Normal"}

All Windows PowerShell comparison operators are valid in the script block format. For more information about comparison operators, see about_Comparison_Operators (http://go.microsoft.com/fwlink/?LinkID=113217).

Comparison statement. You can also write a comparison statement, which is much more like natural language. Comparison statements were introduced in Windows PowerShell 3.0.

For example, the following commands also get processes that have a priority class of Normal. These commands are equivalent and can be used interchangeably.

Get-Process | Where-Object -Property PriorityClass -eq -Value "Normal"

Get-Process | Where-Object PriorityClass -eq "Normal"

Starting in Windows PowerShell 3.0, Where-Object adds comparison operators as parameters in a Where-Object command. Unless specified, all operators are case-insensitive. Prior to Windows PowerShell 3.0, the comparison operators in the Windows PowerShell language could be used only in script blocks.

Parameters

-Contains

Indicates that this cmdlet gets objects if any item in the property value of the object is an exact match for the specified value.

For example: Get-Process | where ProcessName -Contains "Svchost"

If the property value contains a single object, Windows PowerShell converts it to a collection of one object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IContains

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-EQ

Indicates that this cmdlet gets objects if the property value is the same as the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IEQ

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-FilterScript<ScriptBlock>

Specifies the script block that is used to filter the objects. Enclose the script block in braces ( {} ).

The parameter name, FilterScript, is optional.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-GE

Indicates that this cmdlet gets objects if the property value is greater than or equal to the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IGE

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-GT

Indicates that this cmdlet gets objects if the property value is greater than the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IGT

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-In

Indicates that this cmdlet gets objects if the property value matches any of the specified values.

For example: Get-Process | where -Property ProcessName -in -Value "Svchost", "TaskHost", "WsmProvHost"

If the value of the Value parameter is a single object, Windows PowerShell converts it to a collection of one object.

If the property value of an object is an array, Windows PowerShell uses reference equality to determine a match. Where-Object returns the object only if the value of the Property parameter and any value of Value are the same instance of an object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IIn

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-InputObject<PSObject>

Specifies the objects to be filtered. You can also pipe the objects to Where-Object.

When you use the InputObject parameter with Where-Object, instead of piping command results to Where-Object, the InputObject value is treated as a single object. This is true even if the value is a collection that is the result of a command, such as -InputObject (Get-Process). Because InputObject cannot return individual properties from an array or collection of objects, we recommend that, if you use Where-Object to filter a collection of objects for those objects that have specific values in defined properties, you use Where-Object in the pipeline, as shown in the examples in this topic.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-Is

Indicates that this cmdlet gets objects if the property value is an instance of the specified .NET Framework type. Enclose the type name in square brackets.

For example, Get-Process | where StartTime -Is [DateTime]

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-IsNot

Indicates that this cmdlet gets objects if the property value is not an instance of the specified .NET Framework type.

For example, Get-Process | where StartTime -IsNot [System.String]

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LE

Indicates that this cmdlet gets objects if the property value is less than or equal to the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

ILE

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-LT

Indicates that this cmdlet gets objects if the property value is less than the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

ILT

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Like

Indicates that this cmdlet gets objects if the property value matches a value that includes wildcard characters.

For example: Get-Process | where ProcessName -Like "*host"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

ILike

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Match

Indicates that this cmdlet gets objects if the property value matches the specified regular expression. When the input is scalar, the matched value is saved in $Matches automatic variable.

For example: Get-Process | where ProcessName -Match "shell"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

IMatch

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NE

Indicates that this cmdlet gets objects if the property value is different than the specified value.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

INE

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NotContains

Indicates that this cmdlet gets objects if none of the items in the property value is an exact match for the specified value.

For example: Get-Process | where ProcessName -NotContains "Svchost"

NotContains refers to a collection of values and is true if the collection does not contain any items that are an exact match for the specified value. If the input is a single object, Windows PowerShell converts it to a collection of one object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

INotContains

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NotIn

Indicates that this cmdlet gets objects if the property value is not an exact match for any of the specified values.

For example: Get-Process | where -Value "svchost" -NotIn -Property ProcessName

If the value of Value is a single object, Windows PowerShell converts it to a collection of one object.

If the property value of an object is an array, Windows PowerShell uses reference equality to determine a match. Where-Object returns the object only if the value of Property and any value of Value are not the same instance of an object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

INotIn

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NotLike

Indicates that this cmdlet gets objects if the property value does not match a value that includes wildcard characters.

For example: Get-Process | where ProcessName -NotLike "*host"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

INotLike

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-NotMatch

Indicates that this cmdlet gets objects when the property value does not match the specified regular expression. When the input is scalar, the matched value is saved in $Matches automatic variable.

For example: Get-Process | where ProcessName -NotMatch "PowerShell"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

INotMatch

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Property<String>

Specifies the name of an object property.

The parameter name, Property, is optional.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Value<Object>

Specifies a property value.

The parameter name, Value, is optional.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CContains

Indicates that this cmdlet gets objects from a collection if the property value of the object is an exact match for the specified value. This operation is case-sensitive.

For example: Get-Process | where ProcessName -CContains "svchost"

CContains refers to a collection of values and is true if the collection contains an item that is an exact match for the specified value. If the input is a single object, Windows PowerShell converts it to a collection of one object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CEQ

Indicates that this cmdlet gets objects if the property value is the same as the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CGE

Indicates that this cmdlet gets objects if the property value is greater than or equal to the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CGT

Indicates that this cmdlet gets objects if the property value is greater than the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CIn

Indicates that this cmdlet gets objects if the property value includes the specified value. This operation is case-sensitive.

For example: Get-Process | where -Value "svchost" -CIn ProcessName

CIn resembles CContains, except that the property and value positions are reversed. For example, the following statements are both true.

"abc", "def" -CContains "abc"

"abc" -CIn "abc", "def"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CLE

Indicates that this cmdlet gets objects if the property value is less-than or equal to the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CLT

Indicates that this cmdlet gets objects if the property value is less-than the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CLike

Indicates that this cmdlet gets objects if the property value matches a value that includes wildcard characters. This operation is case-sensitive.

For example: Get-Process | where ProcessName -CLike "*host"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CMatch

Indicates that this cmdlet gets objects if the property value matches the specified regular expression. This operation is case-sensitive. When the input is scalar, the matched value is saved in $Matches automatic variable.

For example: Get-Process | where ProcessName -CMatch "Shell"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CNE

Indicates that this cmdlet gets objects if the property value is different than the specified value. This operation is case-sensitive.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CNotContains

Indicates that this cmdlet gets objects if the property value of the object is not an exact match for the specified value. This operation is case-sensitive.

For example: Get-Process | where ProcessName -CNotContains "svchost"

"NotContains" and "CNotContains refer to a collection of values and are true when the collection does not contains any items that are an exact match for the specified value. If the input is a single object, Windows PowerShell converts it to a collection of one object.

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CNotIn

Indicates that this cmdlet gets objects if the property value is not an exact match for the specified value. This operation is case-sensitive.

For example: Get-Process | where -Value "svchost" -CNotIn -Property ProcessName

NotIn and CNotIn operators resemble NotContains and CNotContains, except that the property and value positions are reversed. For example, the following statements are true.

"abc", "def" -CNotContains "Abc"

"abc" -CNotIn "Abc", "def"


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CNotLike

Indicates that this cmdlet gets objects if the property value does not match a value that includes wildcard characters. This operation is case-sensitive.

For example: Get-Process | where ProcessName -CNotLike "*host"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-CNotMatch

Indicates that this cmdlet gets objects if the property value does not match the specified regular expression. This operation is case-sensitive. When the input is scalar, the matched value is saved in $Matches automatic variable.

For example: Get-Process | where ProcessName -CNotMatch "Shell"

This parameter was introduced in Windows PowerShell 3.0.


Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters.

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • System.Management.Automation.PSObject

    You can pipe the objects to this cmdlet.


Outputs

The output type is the type of the objects that the cmdlet emits.

  • Object

    This cmdlet returns selected items from the input object set.


Notes

  • Starting in Windows PowerShell 4.0, Where() operator behavior has changed. Collection.Where('property -match name') no longer accepts string expressions in the format Property -CompareOperator Value. However, the Where() operator accepts string expressions in the format of a scriptblock; this is still supported. The following examples show the behavior that has changed.

    The following two examples show Where() object behavior that is no longer supported.

    (Get-Process).Where('ProcessName -match PowerShell')

    (Get-Process).Where('ProcessName -match PowerShell', 'Last', 1)

    The following three examples show Where() object behavior that is supported in Windows PowerShell 4.0 and subsequent versions of Windows PowerShell.

    (Get-Process).Where({$_.ProcessName -match "PowerShell"})

    (Get-Process).Where{$_.ProcessName -match "PowerShell"}

    (Get-Process).Where({$_.ProcessName -match "PowerShell"}, 'Last', 1)

Examples

Example 1: Get stopped services

This command gets a list of all services that are currently stopped. The $_ symbol represents each object that is passed to the Where-Object cmdlet.

The first command uses the script block format. The second command uses the comparison statement format. The commands are equivalent and can be used interchangeably.


PS C:\> Get-Service | Where-Object {$_.Status -eq "Stopped"}
PS C:\> Get-Service | where Status -eq "Stopped"

Example2: Get processes based on working set

This command lists processes that have a working set greater than 25,000 kilobytes (KB). Because the value of the WorkingSet property is stored in bytes, the value of 25,000 is multiplied by 1,024.

The first command uses the script block format. The second command uses the comparison statement format. The commands are equivalent and can be used interchangeably.


PS C:\> Get-Process | Where-Object {$_.WorkingSet -gt 25000*1024}
PS C:\> Get-Process | Where-Object WorkingSet -gt (25000*1024)

Example 3: Get processes based on process name

This command gets the processes that have a ProcessName property value that begins with the letter p. The match operator lets you use regular expression matches.

The first command uses the script block format. The second command uses the comparison statement format. The commands are equivalent and can be used interchangeably.


PS C:\> Get-Process | Where-Object {$_.ProcessName -Match "^p.*"}
PS C:\> Get-Process | Where-Object ProcessName -Match "^p.*"

Example 4: Use the comparison statement format

This example shows how to use the new comparison statement format of the Where-Object cmdlet.

The first command uses the comparison statement format. In this command, no aliases are used and all parameters include the parameter name.

The second command is the more natural use of the comparison command format. The where alias is substituted for the Where-Object cmdlet name and all optional parameter names are omitted.


PS C:\> Get-Process | Where-Object -Property Handles -GE -Value 1000
PS C:\> Get-Process | where Handles -GEe 1000

Example 5: Get commands based on properties

This example shows how to write commands that return items that are true or false or have any value for a specified property. The example shows both the script block and comparison statement formats for the command.


 

The first pair of commands gets commands that have any value for the OutputType property of the command. They omit commands that do not have an OutputType property and those that have an OutputType property, but no property value.


PS C:\> Get-Command | where OutputType
PS C:\> Get-Command | where {$_.OutputType}

 

The second pair of commands gets objects that are containers. It gets objects that have the PSIsContainer property with a value of $True and excludes all others.

The "equals $True" (-eq $True) part of the command is assumed by the language. You do not need to specify it explicitly.


PS C:\> Get-ChildItem | where PSIsContainer
PS C:\> Get-ChildItem | where {$_.PSIsContainer}

 

The third pair of commands uses the Not operator (!) to get objects that are not containers. It gets objects that do have the PSIsContainer property and those that have a value of $False for the PSIsContainer property.

You cannot use the Not operator (!) in the comparison statement format of the command.


PS C:\> Get-ChildItem | where {!$_.PSIsContainer}
PS C:\> Get-ChildItem | where PSIsContainer -eq $False

Example 6: Use multiple conditions

This example shows how to create a Where-Object command with multiple conditions.

This command gets non-core modules that support the Updatable Help feature. The command uses the ListAvailable parameter of the Get-Module cmdlet to get all modules on the computer. A pipeline operator (|) sends the modules to the Where-Object cmdlet, which gets modules whose names do not begin with Microsoft or PS, and have a value for the HelpInfoURI property, which tells Windows PowerShell where to find updated help files for the module. The comparison statements are connected by the And logical operator.

The example uses the script block command format. Logical operators, such as And and Or, are valid only in script blocks. You cannot use them in the comparison statement format of a Where-Object command.

For more information about Windows PowerShell logical operators, see about_Logical_Operators (http://go.microsoft.com/fwlink/?LinkID=113238). For more information about the Updatable Help feature, see about_Updatable_Help (http://go.microsoft.com/fwlink/?LinkID=235801).


PS C:\> Get-Module -ListAvailable | where {($_.Name -notlike "Microsoft*" -and $_.Name -notlike "PS*") -and $_.HelpInfoUri}

Related topics

Community Additions

ADD
Show:
© 2016 Microsoft