From 7925d7552b41c07f6c147c622dedda1458d55c63 Mon Sep 17 00:00:00 2001 From: ChristianOe <39793553+ChristianOe@users.noreply.github.com> Date: Wed, 27 Nov 2024 16:21:17 +0100 Subject: [PATCH] Update Test-AppList.ps1 Improved Invoke-MSGraphOperation to only invoked one time for the whole process to improve the performance of update checks --- Scripts/Test-AppList.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Scripts/Test-AppList.ps1 b/Scripts/Test-AppList.ps1 index 99c34b0..9b7937b 100644 --- a/Scripts/Test-AppList.ps1 +++ b/Scripts/Test-AppList.ps1 @@ -297,6 +297,10 @@ Process { # Foreach application in appList.json, check existence in Intunem and determine if new application / version should be published $AppsProcessList = Get-Content -Path $AppsProcessListFilePath -ErrorAction "Stop" | ConvertFrom-Json + + #Retrieve all apps from Intune + $Win32AppResources = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')" + foreach ($App in $AppsProcessList) { Write-Output -InputObject "[APPLICATION: $($App.IntuneAppName)] - Initializing" @@ -367,7 +371,6 @@ Process { # Attempt to locate the application in Intune Write-Output -InputObject "Attempting to find application in Intune using naming convention: $($AppDisplayName)" - $Win32AppResources = Invoke-MSGraphOperation -Get -APIVersion "Beta" -Resource "deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')" if ($Win32AppResources -ne $null) { # Detect Win32 application matching displayName @@ -501,4 +504,4 @@ Process { Write-Output -InputObject "##vso[task.setvariable variable=shouldrun;isOutput=true]false" throw "$($MyInvocation.MyCommand): Failed to retrieve authentication token with error message: $($_.Exception.Message)" } -} \ No newline at end of file +}