Forum Discussion

NickEckermann's avatar
NickEckermann
Copper Contributor
Sep 23, 2022

Trying to get Intune device hardware information with Graph, but some of the data comes back null

Hello I am trying to get Intune device hardware data with Graph and I am not having any luck. Most of it comes back null
At this point I am just trying to get the System Management BIOS version which shows in Intune on the hardware tab of a device.

Using this command (Get-MgDeviceManagementManagedDevice -ManagedDeviceId $ManagedDevice.Id).HardwareInformation

 

The documentation show it should return data.

The graph explorer also returns null data.

 

The data is in Intune as you can see here. Where is this data stored in Graph?

 



Any help would be appreciated.
  • Based on comments from another post I was able to achieve what I wanted with this below. 

     

    Disconnect-Graph
    Connect-MgGraph -Scopes DeviceManagementManagedDevices.Read.All, Directory.ReadWrite.All
    Select-MgProfile -Name beta
    $ManagedDevices = Get-MgDeviceManagementManagedDevice -Filter "Model eq 'HP EliteBook 840 G8 Notebook PC'"
    
    foreach ($ManagedDevice in $ManagedDevices){
        # Get hardware details for the device
        $ManagedDeviceHardware = (Get-MgDeviceManagementManagedDevice -ManagedDeviceId $ManagedDevice.Id -Property "hardwareInformation").HardwareInformation
    
        # Flag which basebase board the device is and add ExtensionAttribute per baseboard
        if (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T76*')){
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 880D Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 880D"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
    
        }elseif (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T39*')) {
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 8AB3 Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 8AB3"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
    
        }elseif (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T37*')) {
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 8AB8 Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 8AB8"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
        }else {
            Write-Output -InputObject "Unable to determine the Baseboard "
        }
    }
  • NickEckermann's avatar
    NickEckermann
    Copper Contributor

    Based on comments from another post I was able to achieve what I wanted with this below. 

     

    Disconnect-Graph
    Connect-MgGraph -Scopes DeviceManagementManagedDevices.Read.All, Directory.ReadWrite.All
    Select-MgProfile -Name beta
    $ManagedDevices = Get-MgDeviceManagementManagedDevice -Filter "Model eq 'HP EliteBook 840 G8 Notebook PC'"
    
    foreach ($ManagedDevice in $ManagedDevices){
        # Get hardware details for the device
        $ManagedDeviceHardware = (Get-MgDeviceManagementManagedDevice -ManagedDeviceId $ManagedDevice.Id -Property "hardwareInformation").HardwareInformation
    
        # Flag which basebase board the device is and add ExtensionAttribute per baseboard
        if (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T76*')){
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 880D Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 880D"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
    
        }elseif (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T39*')) {
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 8AB3 Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 8AB3"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
    
        }elseif (($ManagedDeviceHardware.Model -eq 'HP EliteBook 840 G8 Notebook PC') -and ($ManagedDeviceHardware.SystemManagementBiosVersion -like 'T37*')) {
            Write-Output -InputObject "$($ManagedDevice.DeviceName) is a HP EliteBook 840 G8 Notebook PC with the 8AB8 Baseboard"
            # Parameters for setting ExtensionAttribute
            $Parameters = @{
                ExtensionAttributes = @{
                    ExtensionAttribute1 = "HP EliteBook 840 G8 Notebook PC 8AB8"
                }
            }
            # Add ExtensionAttribute1 to Device
            Update-MgDevice -DeviceId $ManagedDevice.Id -BodyParameter $Parameters
        }else {
            Write-Output -InputObject "Unable to determine the Baseboard "
        }
    }

Resources