Help with StartsWith filter in Powershell

Copper Contributor

Trying to get a list of Intune Devices from Graph where their names start with "PSY-"

Running the command below in Powershell:

 $uri1 = "https://graph.microsoft.com/beta/deviceManagement/managedDevices?`$filter=startswith(Devicename, 'PSY-')"

 $Results = (Invoke-RestMethod -Uri $uri1 -Headers $authToken -Method Get).value
 $results.devicename 

This works but also gives me devices that start with "EPSY-", another department. Shouldn't the StartsWith only get devices that specifically start with "PSY-"?

How can I resolve this?

Thanks!

 

0 Replies