From 8a801242073b6b317270682dd3652dfe0f268045 Mon Sep 17 00:00:00 2001 From: Kevin Greer Date: Tue, 3 Feb 2026 11:49:41 -0500 Subject: [PATCH] Added query by Developer value --- Public/Get-IntuneWin32App.ps1 | 46 +++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/Public/Get-IntuneWin32App.ps1 b/Public/Get-IntuneWin32App.ps1 index 1086793..89ac1d4 100644 --- a/Public/Get-IntuneWin32App.ps1 +++ b/Public/Get-IntuneWin32App.ps1 @@ -1,12 +1,12 @@ function Get-IntuneWin32App { <# .SYNOPSIS - Get all or a specific Win32 app by either DisplayName or ID. + Get all or a specific Win32 app by either DisplayName, ID, or Developer. .DESCRIPTION - Get all or a specific Win32 app by either DisplayName or ID. - - Note: When querying by DisplayName, the function queries Graph API's list endpoint which may have + Get all or a specific Win32 app by either DisplayName, ID, or Developer. + + Note: When querying by DisplayName, the function queries Graph API's list endpoint which may have eventual consistency delays. Newly created apps may not appear in list queries for several minutes, even though they're immediately accessible by direct ID query. This is expected Graph API behavior. @@ -16,6 +16,9 @@ function Get-IntuneWin32App { .PARAMETER ID Specify the ID for a Win32 application. + .PARAMETER Developer + Specify developer value for a Win32 application. + .NOTES Author: Nickolaj Andersen Contact: @NickolajA @@ -38,7 +41,11 @@ function Get-IntuneWin32App { [parameter(Mandatory = $true, ParameterSetName = "ID", HelpMessage = "Specify the ID for a Win32 application.")] [ValidateNotNullOrEmpty()] - [string]$ID + [string]$ID, + + [parameter(Mandatory = $false, ParameterSetName = "Developer", HelpMessage = "Specify developer value for a Win32 application.")] + [ValidateNotNullOrEmpty()] + [string]$Developer ) Begin { # Ensure required authentication header variable exists @@ -92,6 +99,35 @@ function Get-IntuneWin32App { return $null } } + "Developer" { + $Win32AppList = New-Object -TypeName "System.Collections.Generic.List[Object]" + $Win32MobileApps = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')" + if ($null -ne $Win32MobileApps -and $Win32MobileApps.Count -gt 0) { + Write-Verbose -Message "Retrieved $($Win32MobileApps.Count) total Win32 apps from tenant" + Write-Verbose -Message "Filtering for Win32 apps matching developer using pattern: *$($Developer)*" + $Win32MobileApps = $Win32MobileApps | Where-Object { $_.developer -like "*$($Developer)*" } + if ($null -ne $Win32MobileApps -and $Win32MobileApps.Count -gt 0) { + Write-Verbose -Message "Found $($Win32MobileApps.Count) app(s) matching the developer filter" + foreach ($Win32MobileApp in $Win32MobileApps) { + $Win32App = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps/$($Win32MobileApp.id)" + $Win32AppList.Add($Win32App) + } + + # Handle return value + return $Win32AppList + } + else { + Write-Verbose -Message "Query for Win32 app returned an empty result, no apps matching the specified search criteria was found" + Write-Verbose -Message "Note: If searching for a newly created app, Graph API list endpoints may not reflect it immediately due to caching" + } + } + else { + Write-Verbose -Message "Query for Win32 apps returned an empty result, no apps matching type 'win32LobApp' was found in tenant" + } + + # Return empty array for consistency + return @() + } default { $Win32AppList = New-Object -TypeName "System.Collections.Generic.List[Object]" $Win32MobileApps = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')"