SOLVED

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

Copper Contributor
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
neckermann81_1-1663965682875.png

 

The documentation show it should return data.

The graph explorer also returns null data.
neckermann81_2-1663965703177.png

 

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

 



Any help would be appreciated.
1 Reply
best response confirmed by NickEckermann (Copper Contributor)
Solution

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 "
    }
}
1 best response

Accepted Solutions
best response confirmed by NickEckermann (Copper Contributor)
Solution

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 "
    }
}

View solution in original post