Change filter in computers flow designer action

Community Alums
Not applicable

I want to change filter condition for intune action in flow designer to fetch computers

OOB filter is /deviceManagement/managedDevices?$filter=operatingSystem eq 'Linux' or operatingSystem eq 'macOS' or operatingSystem eq 'Windows' or operatingSystem eq 'Chrome OS'

 

I also want to include condition for model notContains 'test1' and model notContains 'test2' and model notContains 'test3'

 

How can I add this condition?

2 REPLIES 2

Sayali Gurav
Tera Guru
Tera Guru

To add the additional conditions for model filtering in the Intune action, you can modify the existing filter expression. Here's the modified filter expression you can use:
plaintext
/deviceManagement/managedDevices?$filter=(operatingSystem eq 'Linux' or operatingSystem eq 'macOS' or operatingSystem eq 'Windows' or operatingSystem eq 'Chrome OS') and (not contains(model, 'test1') and not contains(model, 'test2') and not contains(model, 'test3'))
This expression combines the existing operating system conditions with the new model conditions using and. It also uses not contains to filter out devices with the specified model names.

Make sure to replace the existing filter expression in your flow designer with this modified expression. This should give you the desired results.

 

Mark helpful or correct if applicable.

Thanks & Regards,

Sayali Gurav

Hi Gurav,

 

I have similar requirement with the existing condition to get device name contains 'secure' and 'apple'.

Below is the modified filter and it gives secure devices:

/deviceManagement/managedDevices?$filter=(operatingSystem eq 'Linux' or operatingSystem eq 'macOS' or operatingSystem eq 'Windows' or operatingSystem eq 'Chrome OS' ) and (contains(deviceName, 'SECURE'))

 

Along with secure devices combining device name contains apple also, below is the modified filter used but not working:

/deviceManagement/managedDevices?$filter=(operatingSystem eq 'Linux' or operatingSystem eq 'macOS' or operatingSystem eq 'Windows' or operatingSystem eq 'Chrome OS' ) and (contains(deviceName, 'SECURE')and contains(deviceName, 'APPLE'))

 

Could you please share how to include both device name contains apple and secure, it will helpful.

 

Thanks,

Sai Kumar