Microsoft.Graph.Intune examples aren't reflected in reality

ComputerHabit 1,051 Reputation points
2023-09-12T23:06:50.0266667+00:00

I am attempting to use the Intune Powershell SDK

https://github.com/microsoft/Intune-PowerShell-SDK

Examples show that if I run Get-IntuneManagedDevice it will return devices. But it returns something else.

I end up with 1 item and it contains odata information instead.

User's image

Microsoft Security | Intune | Other
Microsoft Security | Microsoft Graph
{count} votes

5 answers

Sort by: Most helpful
  1. Lu Dai-MSFT 28,516 Reputation points
    2023-09-13T02:56:44.9466667+00:00

    @ComputerHabit Thanks for posting in our Q&A.

    For this issue, if you want to get detailed information about a specific device, please run the following command:

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

    User's image

    If you only want to get some information of all the devices, for example: get device name and device id of all devices.

    Get-IntuneManagedDevice |select-object deviceName, id
    

    User's image

    Hope it will give you some ideas.


    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. ComputerHabit 1,051 Reputation points
    2023-09-13T13:20:50.4833333+00:00

    There must be something about the setup I'm missing. I'm not getting the data properly.

    Is there additional configuration needed?

    Install-Module -Name Microsoft.Graph.Intune
    Connect-MSGraph -AdminConsent
    Login with Global Admin (I have permissions to everything)
    Get-IntuneManagedDevice | select-object deviceName, id (FAILs here) EMPTY

    0 comments No comments

  3. ComputerHabit 1,051 Reputation points
    2023-09-13T13:28:13.17+00:00

    I'm going back to the readme.
    https://github.com/microsoft/Intune-PowerShell-SDK/blob/master/README.md

    I was following examples elsewhere and nobody mentions part of the setup. I'm really not sure what this means.... the one-stime setup isn't clear....

    Install .net 4.7.1 and find this releases and install some extra extra stuff? WTF.
    User's image


  4. ComputerHabit 1,051 Reputation points
    2023-09-14T00:19:01.9766667+00:00

    I found an example that started to work for me.

    Get-IntuneManagedDevice | Get-MSGraphAllPages | Where { ($_.userPrincipalName -eq $userprincipalname)} | Select-object deviceName, id, serialNumber

    I'll have to figure out WHY... I think it's that I'm returning to much data.

    0 comments No comments

  5. ComputerHabit 1,051 Reputation points
    2023-09-14T13:16:36.6266667+00:00

    I have to say the module needs work. Lots of it.

    All the examples I see are from tenants with only a few items in Azure. I'm not seeing anyone provide examples with large data sets.

    This works:
    Get-IntuneManagedDevice | Get-MSGraphAllPages | Select-object deviceName, id, serialNumber

    But the general example given does NOT WORK.....
    Get-IntuneManagedDevice | Select-object deviceName, id, serialNumber

    If you have the device ID that works...

    Get-IntuneManagedDevice -managedDeviceId sdjfsdjdfjssd

    So the examples SUUUCK for real tenants.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.