Use PowerShell and MS Graph to locate an Intune device

In this post I will show you how to use PowerShell and MS Graph to locate an Intune device.


You will first have to enable location on your device.

You can check it in the notification center as below:

You can enable it by clicking on it.

You can also enable it with PowerShell as below:

Locate device

Microsoft has added the possibility to locate an Intune device through the portal.

See the new alert from the what's new in Intune link.

For that, just go to a device and click on Locate device, as below:

Locate with PowerShell

Now let's do this with PowerShell.

1. You will first need to get the ID of the device. I will check device that has a specific name as below:

2. Then I will get the ID:

3. Now I will run the locate device action, as below:

4. The next step is to check device location result using below command:

5. The result is empty because you have to wait a bit.

6. On you device, you will get the below notification:

7. Now let's check again with PowerShell:

8. See below result:

Display in MAP and address 
Now let's see how to get address info with PowerShell and how to open a MAP with device location.
1. We will first get Latitude and Longitude
2. We will show location in MAPS, as below:
3. See below the result:

4. We will get full location as below:
5. See below the result:

slider 3776174808262866544

Publier un commentaire

1 commentaire

Fred a dit…

Of course, no company will ever use this to track their employees... (。_。)

Accueil item


Endpoint Manager award

Mes articles en français

Author of Books

PowerShell GUI & WPF Group

PowerShell GUI & WPF Group

Join the FPSUGR

Join the FPSUGR