Intune powershell

AsAdmin 396 Reputation points
2022-05-31T08:49:09.647+00:00

Hi Team,

If I only have "device name" can i query Intune via Powershell or graph API to get device details like Intune device id, serial number etc?

Belwo powershell command gives the details of Azure AD, but not include Intune device ID. Do we have such commands for Intune?

Get-MsolDevice -Name "devicename"

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

Accepted answer
  1. Lu Dai-MSFT 28,356 Reputation points
    2022-06-01T08:36:02.647+00:00

    @AsAdmin Thanks for your update.

    If you just want to query only 1 single device at a time, it is suggested to run the following command:

    Get-IntuneManagedDevice | Where-Object {$_.deviceName -eq "<target device name>"}  
    

    207486-image.png

    If you want to get some information of this device, please refer to the following command:

    Get-IntuneManagedDevice | Where-Object {$_.deviceName -eq "<target device name>"} | Select-object deviceName, id, serialNumber  
    

    207379-image.png

    Hope it is what you want.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Lu Dai-MSFT 28,356 Reputation points
    2022-06-01T02:04:59.73+00:00

    @AsAdmin Thanks for posting in our Q&A.

    For this issue, I have done the test in my lab.
    I 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  
    

    207255-image.png

    When I use the following command, I can get device details.

    Get-IntuneManagedDevice  
    

    207250-image.png

    If you want to get some information, it can be filtered. For example, I want to show "deviceName, deviceID, serial number".

    Get-IntuneManagedDevice | Select-object deviceName, id, serialNumber  
    

    207324-image.png

    Hope it will help.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    2 people found this answer helpful.