XPath expression examples

Ryan Newington edited this page May 27, 2016 · 1 revision

The New-XPathQuery, New-XPathQueryGroup and New-XPathExpression cmdlets can be used to create many different query types. This page demonstrates how various expressions are rendered based on their attribute types.

String

Operator Example
Equals /Person[(AccountName = 'ryan')]
NotEquals /Person[(not(AccountName = 'ryan'))]
GreaterThan <not supported>
GreaterThanOrEquals <not supported>
LessThan <not supported>
LessThanOrEquals <not supported>
IsPresent /Person[(starts-with(AccountName, '%'))]
IsNotPresent /Person[(not(starts-with(AccountName, '%')))]
Contains /Person[(contains(DisplayName, 'ryan'))]
StartsWith /Person[(starts-with(DisplayName, 'ryan'))]
EndsWith /Person[(ends-with(DisplayName, 'ryan'))]

Integer

Operator Example
Equals /Person[(unixGid = 44)]
NotEquals /Person[(not(unixGid = 44))]
GreaterThan /Person[(unixGid > 44)]
GreaterThanOrEquals /Person[(unixGid >= 44)]
LessThan /Person[(unixGid < 44)]
LessThanOrEquals /Person[(unixGid <= 44)]
IsPresent /Person[(unixGid <= 999999999999999)]
IsNotPresent /Person[(not(unixGid <= 999999999999999))]
Contains <not supported>
StartsWith <not supported>
EndsWith <not supported>

DateTime

Operator Example
Equals /Person[(ExpiryDate = '2015-12-31T00:00:00.000')]
NotEquals /Person[(not(ExpiryDate = '2015-12-31T00:00:00.000'))]
GreaterThan /Person[(ExpiryDate > '2015-12-31T00:00:00.000')]
GreaterThanOrEquals /Person[(ExpiryDate >= '2015-12-31T00:00:00.000')]
LessThan /Person[(ExpiryDate < '2015-12-31T00:00:00.000')]
LessThanOrEquals /Person[(ExpiryDate <= '2015-12-31T00:00:00.000')]
IsPresent /Person[(ExpiryDate <= '9999-12-31T23:59:59.997')]
IsNotPresent /Person[(not(ExpiryDate <= '9999-12-31T23:59:59.997'))]
Contains <not supported>
StartsWith <not supported>
EndsWith <not supported>

Boolean

Operator Example
Equals /Person[(AccountDisabled = true)]
NotEquals /Person[(not(AccountDisabled = true))]
GreaterThan <not supported>
GreaterThanOrEquals <not supported>
LessThan <not supported>
LessThanOrEquals <not supported>
IsPresent /Person[((AccountDisabled = true) or (AccountDisabled = false))]
IsNotPresent /Person[(not(((AccountDisabled = true) or (AccountDisabled = false)))]
Contains <not supported>
StartsWith <not supported>
EndsWith <not supported>

Reference

Operator Example
Equals /Person[(Manager = '3ede2d5f-a6db-4795-b07a-827840024940')]
Equals (expression) /Person[(Manager = /Person[(AccountName = 'ryan')])]
NotEquals /Person[(not(Manager = '3ede2d5f-a6db-4795-b07a-827840024940'))]
GreaterThan <not supported>
GreaterThanOrEquals <not supported>
LessThan <not supported>
LessThanOrEquals <not supported>
IsPresent /Person[(Manager = /*)]
IsNotPresent /Person[(not(Manager = /*))]
Contains <not supported>
StartsWith <not supported>
EndsWith <not supported>

Text

Querying text attributes is not supported by the FIM service

Binary

Querying binary attributes is not supported by the FIM service

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.