Skip to content

Commit

Permalink
Update to added ICCID and UDID
Browse files Browse the repository at this point in the history
  • Loading branch information
davefalkus committed Jun 20, 2019
1 parent 88d749c commit adb4e84
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions ManagedDevices/ManagedDevices_Hardware_Get.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,31 @@ if($Devices){
Write-Host "Device found:" $Device.deviceName -ForegroundColor Yellow
Write-Host

$uri = "https://graph.microsoft.com/beta/deviceManagement/manageddevices('$DeviceID')?`$select=hardwareInformation"
$Hardware = (Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get).hardwareInformation
$uri = "https://graph.microsoft.com/beta/deviceManagement/manageddevices('$DeviceID')?`$select=hardwareinformation,iccid,udid"

$DeviceNoHardware = $Device | select * -ExcludeProperty hardwareInformation,deviceActionResults,userId,imei,manufacturer,model,isSupervised,isEncrypted,serialNumber,meid,subscriberCarrier
$HardwareExcludes = $Hardware | select * -ExcludeProperty sharedDeviceCachedUsers,phoneNumber
$DeviceInfo = (Invoke-RestMethod -Uri $uri -Headers $authToken -Method Get)

$DeviceNoHardware = $Device | select * -ExcludeProperty hardwareInformation,deviceActionResults,userId,imei,manufacturer,model,isSupervised,isEncrypted,serialNumber,meid,subscriberCarrier,iccid,udid
$HardwareExcludes = $DeviceInfo.hardwareInformation | select * -ExcludeProperty sharedDeviceCachedUsers,phoneNumber
$OtherDeviceInfo = $DeviceInfo | select iccid,udid

$Object = New-Object System.Object

foreach($Property in $DeviceNoHardware.psobject.Properties){

$Object | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.Value
$Object | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.Value

}

foreach($Property in $HardwareExcludes.psobject.Properties){

$Object | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.Value
$Object | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.Value

}

foreach($Property in $OtherDeviceInfo.psobject.Properties){

$Object | Add-Member -MemberType NoteProperty -Name $Property.Name -Value $Property.Value

}

Expand All @@ -374,4 +382,4 @@ else {
write-host "No Intune Managed Devices found..." -f green
Write-Host

}
}

0 comments on commit adb4e84

Please sign in to comment.