I often find myself looking in Intune to find a PC name of a machine assigned to a user (it saves having to deploy bginfo or similar), but as with many of my scripts, I like to find a quicker and easier way of doing it.
This one is available both on github and Powershell Gallery:
Install-Script -Name get-intune-details-from-user
It’s nice and simple to use, run the script and you’ll be prompted for the user to search for. This is an exact search on the UPN:

You’ll then get a grid-view output of all devices assigned to the user. If that’s all you need, click Cancel and the box will close

If, however, you want some more juicy details, select the machine and click OK and you’ll get a menu

These are pretty self-explanatory
Device Info gives a full output

Configuration policies gives a list of all policies applied and their status

Compliance policies shows the compliance status

And finally apps shows discovered applications (not managed) and the version

That’s it, simple, but effective. I created some custom functions using the graph API to call the details, they can all be found in the script on github
This would be extremely useful. Thanks Andrew.
Would I have to run the whole script everytime I want to search for the device(s) associated with a user? Or is there a Function I can call that would bring up the GUI instead of installing microsoft.graph everytime?
Hi, it grabs the data live from Graph so needs a connection each time. It detects the modules though so once they are installed, they won’t re-install.
The other option would be to output to a CSV and refer back to that.
I’m missing something here. How to use the script. To what M365 management environment am I connecting to (e.g. connect-exchangeonline) when running this script?
The connection is in the script, it is connecting to graph