You are missing a dot (.) in '$_devicename', and you can omit the quotes as well.
How to get azure AD device Object ID in Bulk

Gene
1
Reputation point
Hello I have this script that i cant get to work? I am trying to load a CSV with a list of devices in Azure I need to extract the devices in an output csv file that has the displayname and the object ID
For some reason this script keeps omitting the Input csv file? Please help
connect-azuread
Import-csv c:\temp\devices.csv | %{get-azureADdevice -searchstring '$_devicename'} | Select Displayname, objectID | export-csv c:\temp\deviceswithObjectID.csv -notypeinformation
Microsoft Security | Microsoft Entra | Microsoft Entra ID
25,080 questions
1 answer
Sort by: Most helpful
-
Vasil Michev 119.5K Reputation points MVP Volunteer Moderator
2022-04-07T07:13:33.393+00:00