From 245a1ac13f8f5a057d2d21f3e917eee605883a58 Mon Sep 17 00:00:00 2001 From: Thomas De Reyck Date: Tue, 8 Apr 2025 12:25:35 +0200 Subject: [PATCH] Added a new report. --- .../intune/report_managed_device_versions.ps1 | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 microsoft/intune/report_managed_device_versions.ps1 diff --git a/microsoft/intune/report_managed_device_versions.ps1 b/microsoft/intune/report_managed_device_versions.ps1 new file mode 100644 index 0000000..83b2ddc --- /dev/null +++ b/microsoft/intune/report_managed_device_versions.ps1 @@ -0,0 +1,106 @@ +Connect-MgGraph -NoWelcome + +$Devices = Get-MgDeviceManagementManagedDevice -All + +$MacOsTotal = 0 +$WindowsTotal = 0 + +$WindowsLatestCount = 0 +$WindowsOtherCount = 0 + +$MacOsLatestCount = 0 +$MacOsOtherCount = 0 + +$MacOsDevices = @{} +$WindowsDevices = @{} + +ForEach($Device in $Devices) { + If($Device.OperatingSystem -like "Windows") { + $WindowsTotal += 1 + If($WindowsDevices[$Device.OSVersion]) { + $WindowsDevices[$Device.OSVersion] += 1 + } Else { + $WindowsDevices.Add($Device.OSVersion,1) + } + + If($Device.OSVersion -like "10.0.2*") { + $WindowsLatestCount += 1 + } Else { + $WindowsOtherCount += 1 + } + + } ElseIf($Device.OperatingSystem -like "macOS") { + $MacOsTotal += 1 + If($MacOsDevices[$Device.OSVersion]) { + $MacOsDevices[$Device.OSVersion] += 1 + } Else { + $MacOsDevices.Add($Device.OSVersion,1) + } + + If($Device.OSVersion -like "15.*") { + $MacOsLatestCount += 1 + } Else { + $MacOsOtherCount += 1 + } + + } +} + +$WindowsResults = $WindowsDevices.GetEnumerator() | Sort-Object -Property Name -Descending +$MacOsResults = $MacOsDevices.GetEnumerator() | Sort-Object -Property Name -Descending + +" + +" +"

Managed Devices Version Report

" +"

Windows Devices

" +"

There are $WindowsTotal managed Windows devices:" +"

" +"

" + +"" +"" + +ForEach($Result in $WindowsResults) { + If($Result.Name -Like "10.0.2*") { + "" + } Else { + "" + } +} + +"
VersionNumber of devices
$($Result.Name)$($Result.Value)
$($Result.Name)$($Result.Value)
" + +"

macOS Devices

" +"

There are $MacOsTotal managed macOS devices:" +"

" +"

" + +"" +"" + +ForEach($Result in $MacOsResults) { + If($Result.Name -Like "15.*") { + "" + } Else { + "" + } +} + +"
VersionNumber of devices
$($Result.Name)$($Result.Value)
$($Result.Name)$($Result.Value)
" + +""