Need to get Intune Device's Enrolledby user's ID via Powershell with Graph

asked 2021-04-14T16:07:41.807+00:00
Ashish Arya 21 Reputation points

HI Team,

May I know how can we leverage Graph using Powershell to extract the Enrolledby user name's object ID for Intune machines.

Regards,
Ashish Arya

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
2,070 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. answered 2021-04-15T03:23:11.383+00:00
    Crystal-MSFT 19,331 Reputation points Microsoft Employee

    @Ashish Arya , I have done a test in my lab. Set the Primary user with a different user with Enrolled By.
    88052-image.png

    Then import Intune module and connect to Microsoft Graph with the following command:

    Import-Module Microsoft.Graph.Intune #import intune module  
    Update-MSGraphEnvironment -SchemaVersion beta #set schema version as beta  
    Connect-MSGraph  #connect to MS grasp  
    

    After that, run the following command to get the testing device information:
    Get-IntuneManagedDevice -managedDeviceId <Intune Device ID>

    After checking the device information, I find the value of the "Enrolled by" is the same as userdisplayname. And the userid is the id of this user.
    87930-image.png
    88015-image.png
    So for your question, I think we can refer to the "userid" property of the device.

    Hope it can help.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.