Where-Object
Selects objects from a collection based on their property values.
구문
EqualSet (기본값)
Where-Object
[-Property] <String>
[[-Value] <Object>]
[-InputObject <PSObject>]
[-EQ]
[<CommonParameters>]
ScriptBlockSet
Where-Object
[-FilterScript] <ScriptBlock>
[-InputObject <PSObject>]
[<CommonParameters>]
MatchSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-Match
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CEQ
[-InputObject <PSObject>]
[<CommonParameters>]
NotEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-NE
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveNotEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CNE
[-InputObject <PSObject>]
[<CommonParameters>]
GreaterThanSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-GT
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveGreaterThanSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CGT
[-InputObject <PSObject>]
[<CommonParameters>]
LessThanSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-LT
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveLessThanSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CLT
[-InputObject <PSObject>]
[<CommonParameters>]
GreaterOrEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-GE
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveGreaterOrEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CGE
[-InputObject <PSObject>]
[<CommonParameters>]
LessOrEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-LE
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveLessOrEqualSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CLE
[-InputObject <PSObject>]
[<CommonParameters>]
LikeSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-Like
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveLikeSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CLike
[-InputObject <PSObject>]
[<CommonParameters>]
NotLikeSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-NotLike
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveNotLikeSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CNotLike
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveMatchSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CMatch
[-InputObject <PSObject>]
[<CommonParameters>]
NotMatchSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-NotMatch
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveNotMatchSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CNotMatch
[-InputObject <PSObject>]
[<CommonParameters>]
ContainsSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-Contains
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveContainsSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CContains
[-InputObject <PSObject>]
[<CommonParameters>]
NotContainsSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-NotContains
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveNotContainsSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CNotContains
[-InputObject <PSObject>]
[<CommonParameters>]
InSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-In
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveInSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CIn
[-InputObject <PSObject>]
[<CommonParameters>]
NotInSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-NotIn
[-InputObject <PSObject>]
[<CommonParameters>]
CaseSensitiveNotInSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-CNotIn
[-InputObject <PSObject>]
[<CommonParameters>]
IsSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-Is
[-InputObject <PSObject>]
[<CommonParameters>]
IsNotSet
Where-Object
[-Property] <String>
[[-Value] <Object>]
-IsNot
[-InputObject <PSObject>]
[<CommonParameters>]
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 syntax. 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 where the value of the PriorityClass property equals
Normal
.Get-Process | Where-Object {$_.PriorityClass -eq "Normal"}
All PowerShell comparison operators are valid in the script block format. For more information, see about_Comparison_Operators.
Simplified syntax. To enable the simiplified syntax,
Where-Object
includes 31 switch parameters that represent the comparison operators. The simplified syntax is easier to read and write than the script block syntax. You can combine one of the switch parameters with the Property and Value parameters to create a command that filters objects based on the values of their properties.For example, the following commands also get processes that have a priority class of
Normal
. These commands are equivalent and you can use them interchangeably.Get-Process | Where-Object -Property PriorityClass -Value Normal -EQ
Get-Process | Where-Object PriorityClass -EQ Normal
As shown in the example, the parameter names Property and Value are optional. The Property parameter is a positional parameter mapped to position
0
. The Value parameter is a positional parameter mapped to position1
. The switch parameter, used to specify the comparison, can be used in any position.The simplified syntax was introduced in Windows PowerShell 3.0. For more information, see about_Simplified_Syntax.
When you provide a single Property to Where-Object
, the cmdlet treats the value of the
property as a boolean expression. When the value of the property's Length isn't zero, the
expression evaluates to $true
. For example: ('hi', '', 'there') | Where-Object Length
The previous example is functionally equivalent to:
('hi', '', 'there') | Where-Object Length -GT 0
('hi', '', 'there') | Where-Object { $_.Length -gt 0 }
For more information about how PowerShell evaluates booleans, see about_Booleans.
예제
Example 1: Get stopped services
These commands get a list of all services that are stopped. The $_
automatic variable represents
each object that's passed to the Where-Object
cmdlet.
The first command uses the script block format, the second command uses the comparison statement format. The commands filter the services the same way and return the same output. Only the syntax is different.
Get-Service | Where-Object { $_.Status -eq "Stopped" }
Get-Service | Where-Object Status -EQ "Stopped"
Example 2: Get processes based on working set
These commands list processes that have a working set greater than 250 megabytes (MB). The commands filter the processes the same way and return the same output. Only the syntax is different.
Get-Process | Where-Object { $_.WorkingSet -gt 250MB }
Get-Process | Where-Object WorkingSet -GT 250MB
Example 3: Get processes based on process name
These commands get the processes that have a ProcessName property value that begins with the
letter p
. The -match
operator and Match parameter let you use regular expression matches.
The commands filter the processes the same way and return the same output. Only the syntax is different.
Get-Process | Where-Object { $_.ProcessName -match "^p.*" }
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. It doesn't use any aliases and includes the name for every parameter.
The second command is the more natural use of the comparison command format. The command
substitutes the where
alias for the Where-Object
cmdlet name and omits all optional parameter
names.
The commands filter the processes the same way and return the same output. Only the syntax is different.
Get-Process | Where-Object -Property Handles -GE -Value 1000
Get-Process | where Handles -GE 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. Each example shows both the script block and comparison statement formats for the command.
The commands filter their input the same way and return the same output. Only the syntax is different.
# Use Where-Object to get commands that have any value for the OutputType
# property of the command. This omits commands that do not have an OutputType
# property and those that have an OutputType property, but no property value.
Get-Command | Where-Object OutputType
Get-Command | Where-Object { $_.OutputType }
# Use Where-Object to get objects that are containers. This gets objects that
# have the **PSIsContainer** property with a value of $true and excludes all
# others.
Get-ChildItem | Where-Object PSIsContainer
Get-ChildItem | Where-Object { $_.PSIsContainer }
# Finally, use the -not operator (!) to get objects that are not containers.
# This gets objects that do have the **PSIsContainer** property and those
# that have a value of $false for the **PSIsContainer** property.
Get-ChildItem | Where-Object { !$_.PSIsContainer }
# You cannot use the -not operator (!) in the comparison statement format
# of the command.
Get-ChildItem | Where-Object PSIsContainer -EQ $false
Example 6: Use multiple conditions
Get-Module -ListAvailable | Where-Object {
($_.Name -notlike "Microsoft*" -and $_.Name -notlike "PS*") -and $_.HelpInfoUri
}
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 don't begin with Microsoft
or PS
, and have a value for the HelpInfoURI property,
which tells PowerShell where to find updated help files for the module. The -and
logical operator
connects the comparison statements.
The example uses the script block command format. Logical operators, such as -and
,-or
, and
-not
are valid only in script blocks. You can't use them in the comparison statement format of a
Where-Object
command.
- For more information about PowerShell logical operators, see about_Logical_Operators.
- For more information about the Updatable Help feature, see about_Updatable_Help.
매개 변수
-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-Object 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, PowerShell converts it to a collection of one object.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveContainsSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveGreaterOrEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveGreaterThanSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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-Object -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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveInSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveLessOrEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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-Object ProcessName -CLike "*host"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveLikeSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveLessThanSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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 a single object, the matched value
is saved in the $Matches
automatic variable.
For example: Get-Process | Where-Object ProcessName -CMatch "Shell"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveMatchSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveNotEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-CNotContains
Indicates that this cmdlet gets objects if the property value of the object isn't an exact match for the specified value. This operation is case-sensitive.
For example: Get-Process | Where-Object ProcessName -CNotContains "svchost"
NotContains and CNotContains refer to a collection of values and are true when the collection doesn't contain any items that are an exact match for the specified value. If the input is a single object, PowerShell converts it to a collection of one object.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveNotContainsSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-CNotIn
Indicates that this cmdlet gets objects if the property value isn't an exact match for the specified value. This operation is case-sensitive.
For example: Get-Process | Where-Object -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"
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveNotInSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-CNotLike
Indicates that this cmdlet gets objects if the property value doesn't match a value that includes wildcard characters. This operation is case-sensitive.
For example: Get-Process | Where-Object ProcessName -CNotLike "*host"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveNotLikeSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-CNotMatch
Indicates that this cmdlet gets objects if the property value doesn't match the specified regular
expression. This operation is case-sensitive. When the input is a single object, the matched value
is saved in the $Matches
automatic variable.
For example: Get-Process | Where-Object ProcessName -CNotMatch "Shell"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
CaseSensitiveNotMatchSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-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-Object ProcessName -Contains "Svchost"
If the input is a single object, PowerShell converts it to a collection of one object.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IContains |
매개 변수 집합
ContainsSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IEQ |
매개 변수 집합
EqualSet
Position: | Named |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-FilterScript
Specifies the script block that's used to filter the objects. Enclose the script block in braces
({}
).
The parameter name, FilterScript, is optional.
매개 변수 속성
형식: | ScriptBlock |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
ScriptBlockSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IGE |
매개 변수 집합
GreaterOrEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IGT |
매개 변수 집합
GreaterThanSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-In
Indicates that this cmdlet gets objects if the property value matches any of the specified values. For example:
Get-Process | Where-Object -Property ProcessName -In -Value "Svchost", "TaskHost", "WsmProvHost"
If the input is a single object, PowerShell converts it to a collection of one object.
If the property value of an object is an array, 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IIn |
매개 변수 집합
InSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-InputObject
Specifies the objects to filter. 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 cmdlet treats the InputObject as a single object. This is true even if
the value is a collection that's the result of a command, such as -InputObject (Get-Process)
.
Because InputObject can't 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.
매개 변수 속성
형식: | PSObject |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
(All)
Position: | Named |
필수: | False |
파이프라인의 값: | True |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Is
Indicates that this cmdlet gets objects if the property value is an instance of the specified .NET type. Enclose the type name in square brackets.
For example, Get-Process | Where-Object StartTime -Is [datetime]
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
IsSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-IsNot
Indicates that this cmdlet gets objects if the property value isn't an instance of the specified .NET type.
For example, Get-Process | where StartTime -IsNot [datetime]
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
IsNotSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | ILE |
매개 변수 집합
LessOrEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Like
Indicates that this cmdlet gets objects if the property value matches a value that includes wildcard
characters (*
).
For example: Get-Process | Where-Object ProcessName -Like "*host"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | ILike |
매개 변수 집합
LikeSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | ILT |
매개 변수 집합
LessThanSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Match
Indicates that this cmdlet gets objects if the property value matches the specified regular
expression. When the input is a single object, the matched value is saved in the $Matches
automatic variable.
For example: Get-Process | Where-Object ProcessName -Match "shell"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | IMatch |
매개 변수 집합
MatchSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | INE |
매개 변수 집합
NotEqualSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | 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-Object ProcessName -NotContains "Svchost"
NotContains refers to a collection of values and is true if the collection doesn't contain any items that are an exact match for the specified value. If the input is a single object, PowerShell converts it to a collection of one object.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | INotContains |
매개 변수 집합
NotContainsSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-NotIn
Indicates that this cmdlet gets objects if the property value isn't an exact match for any of the specified values.
For example: Get-Process | Where-Object -Value "svchost" -NotIn -Property ProcessName
If the value of Value is a single object, PowerShell converts it to a collection of one object.
If the property value of an object is an array, PowerShell uses reference equality to determine a
match. Where-Object
returns the object only if the value of Property and any value of
Value aren't the same instance of an object.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | INotIn |
매개 변수 집합
NotInSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-NotLike
Indicates that this cmdlet gets objects if the property value doesn't match a value that includes
wildcard characters (*
).
For example: Get-Process | Where-Object ProcessName -NotLike "*host"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | INotLike |
매개 변수 집합
NotLikeSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-NotMatch
Indicates that this cmdlet gets objects when the property value doesn't match the specified regular
expression. When the input is a single object, the matched value is saved in the $Matches
automatic variable.
For example: Get-Process | Where-Object ProcessName -NotMatch "powershell"
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | SwitchParameter |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
별칭: | INotMatch |
매개 변수 집합
NotMatchSet
Position: | Named |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Property
Specifies the name of a property of the input object. The property must be an instance property, not a static property. This is a positional parameter, so the name, Property, is optional.
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | String |
Default value: | None |
와일드카드 지원: | False |
DontShow: | False |
매개 변수 집합
EqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
MatchSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
GreaterThanSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveGreaterThanSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LessThanSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLessThanSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
GreaterOrEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveGreaterOrEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LessOrEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLessOrEqualSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LikeSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLikeSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotLikeSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotLikeSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveMatchSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotMatchSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotMatchSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
ContainsSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveContainsSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotContainsSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotContainsSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
InSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveInSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotInSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotInSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
IsSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
IsNotSet
Position: | 0 |
필수: | True |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
-Value
Specifies a property value. The parameter name, Value, is optional. This parameter accepts wildcard characters when used with the following comparison parameters:
- CLike
- CNotLike
- Like
- NotLike
This parameter was introduced in Windows PowerShell 3.0.
매개 변수 속성
형식: | PSObject |
Default value: | None |
와일드카드 지원: | True |
DontShow: | False |
매개 변수 집합
EqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
MatchSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
GreaterThanSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveGreaterThanSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LessThanSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLessThanSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
GreaterOrEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveGreaterOrEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LessOrEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLessOrEqualSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
LikeSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveLikeSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotLikeSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotLikeSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveMatchSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotMatchSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotMatchSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
ContainsSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveContainsSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotContainsSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotContainsSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
InSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveInSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
NotInSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CaseSensitiveNotInSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
IsSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
IsNotSet
Position: | 1 |
필수: | False |
파이프라인의 값: | False |
속성 이름별 파이프라인의 값: | False |
나머지 인수의 값: | False |
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
입력
PSObject
You can pipe any object to this cmdlet.
출력
Object
This cmdlet returns the selected items from the input object set.
참고
Windows PowerShell includes the following aliases for Where-Object
:
?
where
Starting in Windows PowerShell 4.0, Where
and ForEach
methods were added for use with
collections.
You can read more about these methods here about_Arrays