Partager via


5 Minute FIM Hacks: Find the right XPATH syntax to use in FIM PowerShell scripts or advanced set/group definitions

I recently had a colleague ask me to come with XPATH filter that he was using for PowerShell script to capture all users that did not have a specific attribute populated. I often seem to forget nuances of XPATH queries, such as should I be using something like a '!=' or '<>' to denote not present. Something I use now when dealing with XPATH is go to a group/set definition in the portal and try to put in the proper criteria for what I want and then submit it, then use advanced view to look at Filter attribute, this will show my XPATH. So this is the criteria as it looks in the UI:

 

 

 This is advanced view of same set, which exposes XPATH query to use for string attribute not being populated:

So the XPATH that I want is

/Person[not(starts-with(AccountName, '%'))]

This is a different set definition, which looks for users which are a member for a specific group:

 

 

 

## https://blogs.msdn.com/connector_space ##