-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIntuneSoftwareSearch.ps1
29 lines (29 loc) · 1.11 KB
/
IntuneSoftwareSearch.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<#
Author: David Just
Website: github.com/djust270
Date: 10/31/2022
.SYNOPSIS
Search managed device app inventory for specific software. Return Device info, User Info and Software Info (name/version)
#>
param (
[Parameter(Mandatory)]
[ValidateSet('Windows','Android','iOS','macOS')]
[String]$OS,
[Parameter(Mandatory)]
[String]$SoftwareName
)
$Devices = Get-MgDeviceManagementManagedDevice -Filter "startswith(OperatingSystem,`'$OS`')"
foreach ($Device in $Devices){
$SoftwareInventory = [array](Invoke-MgGraphRequest -URI "https://graph.microsoft.com/beta/deviceManagement/manageddevices/$($Device.ID)/detectedApps" -Method GET).Value
$Results = $SoftwareInventory | Where-Object {$_.displayName -like "*$SoftwareName*"}
if ($Results.count -gt 0){
[PSCustomObject]@{
DeviceName = $Device.DeviceName
DeviceID = $Device.ID
UserDisplayName = $Device.UserDisplayName
UserUPN = $Device.UserPrincipalName
SoftwareName = $Results.displayName
SoftwareVersion = $Results.version
}
}
}