Retry Lola Retry

Last Updated on October 25, 2023 by rudyooms

I decided to pull out a part from the IMECache blog as the blog itself was becoming too large.

Troubleshooting Win32 Apps IME | Retry Failed Win32App GRS (call4cloud.nl)

This part was mentioning how you could force a retry when a Win32 app failed to install.

1. Triggering the Reinstallation

Of course, we need to trigger the installation, again and again, to determine the root cause when a Win32 app fails to install. So what options do we have when we want to retry the failed app to reinstall? After the 3 times for 5 minutes have taken place it will wait 24 hours before the GRS / “Global re-evaluation schedule” will kick in is just plain awful

  1. Waiting
  2. Company Portal
  3. The Registry
  4. GRS Manager
  5. A PowerShell Tool

1.1. Waiting

We could wait 24 hours and hopefully, the GRS would kick in to try to reinstall the app someday, sometime.

I guess that’s not the best option we got! But if you don’t care about waiting… this option is the easiest one!

1.2. Company Portal

Of course, everyone uses the Wonderfull Company App and everyone has also assigned the Apps as available so end users can install the apps or reinstall the apps on their own?. When the apps are also made available, we could trigger a reinstallation from the Company App?

Even when your device is “shared” you could initialize a reinstall?

Please note: When triggering the reinstall, first the detection phase will be launched and you guess what happens when it detects the program! The reinstallation will be skipped!

When you don’t want to wait until the company portal app gives you the possibility to reinstall the app as shown above (sorry for the Dutch words) there is still another method available to speed things up!

1.3. The Registry

The best way you could trigger the immediate reinstallation of a Win32App that failed to install is by opening the registry and browsing the IntuneManagementExtension key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\Win32Apps\{SID}\{App Id GUID}

First, you will need to find the Win32 App you are after. But to do so, you will need the have the right App ID. Again you have multiple options to find the needed GUID!

  • You could start looking in the Intune Management Extension event log. As we noticed earlier, it will mention the download and the corresponding App ID
  • The second option you have to find this GUID, is by opening the Endpoint Manager and clicking on the App that needs to be reinstalled. When you selected the App you can make a copy of the GUID in the URL after /appId/.

When we have the App id we are good to go. Just search for it and open the corresponding registry key. When you are sure the app is failing (as an example exit code 1603) you need to remove the whole subkey “159aeebd-fe8a-4571-98ef-de8c72ff5ed5” just like I have marked with a nice red square and restart the Intune Management Extension.

If you want to know more about how these exit codes work and how detection rules work please read this blog as it should tell you more about it

If you don’t want to wait, just delete the whole AppId key it’s also enough to modify the “DownloadStartTimeUTC” in the past 24 hours and wait for the installation will be retried by the GRS schedule.

Please read part 1.4 as it mentions an important update in the WIn32app Install retry flow!

1.4 GRS Manager

It looks like deleting only that key isn’t enough anymore after the Intune Management Extension service got updated some time ago. After you delete the reg key, as shown above, we need to take a look at the IME log with the CMtrace tool. Inside the IME log, GRSManager will tell you that the App with a specific hash is not expired.

We will also notice that the ReevaluationScheduleManager is also mentioning the same hash we noticed earlier! So please make sure after deleting the first GUID you also delete that specific GRS key!

1.5 A PowerShell Tool

Removing the registry key could take up some of your time and we all know time is valuable, so why not use a tool to do so?

Mathias Melkerson is creating a wonderful tool to do so. Please note it looks like with the GRS update it isn’t working as expected. When stumbling upon that GRS key I immediately reached out to Mattias and Andrew (@AndrewZtrhgf) / Twitter. Andrew made sure he added some extra code to make sure it also fetches the hash!

function for getting Intune Win32App GRS hash from Intune log file · GitHub

If somehow that function isn’t working for you, you could try this code below

$appId = "a1d259fe-685d-4f75-bd6b-2785f9bb3688"

$intuneLogList = Get-ChildItem -Path "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs" -Filter "IntuneManagementExtension*.log" -File | sort LastWriteTime -Descending | select -ExpandProperty FullName

if (!$intuneLogList) {
Write-Error "Unable to find any Intune log files. Redeploy will probably not work as expected."
return
}

foreach ($intuneLog in $intuneLogList) {
$appMatch = Select-String -Path $intuneLog -Pattern "\[Win32App\]\[GRSManager\] App with id: $appId is not expired." -Context 0, 1
if ($appMatch) {
foreach ($match in $appMatch) {
$Hash = “”
$LineNumber = 0
$LineNumber = $match.LineNumber
$Hash = Get-Content $intuneLog | Select-Object -Skip $LineNumber -First 1
if ($hash) {
$hash = $hash.Replace('+','\+')
return $hash
}
}
}
}

Conclusion

Having the possibility to retry failed apps is great! Hopefully, you also have read part 1.4 that is mentioning the GRS manager key. Sometimes Microsoft updates the IME and with it, some things change.!

Updates GIFs - Get the best GIF on GIPHY

10 thoughts on “Retry Lola Retry

  1. Hi Rudy, thanks for the explanation.
    Deleting the entire IntuneManagementExtension key and restarting the service has been my style for years now. However, if i install an app through the Company Portal, and uninstall it (manually don’t know if this makes a difference), the app status in the cloud portal is not updated. Still on ‘installed’. It takes forever, sometimes half a day to update, and is preventing reinstallation. Do you know how the application status for all apps can be rechecked / updated?

    1. I have the same issue with the install status in intune, which is not refreshing – not reliable the information, which intune is providing.

  2. Thanks, for the article. Deleting all findings with APP-ID and restarting the management extension service resolves this issue for me as well.

  3. 1.3 Mentions “Just search for it and”…

    Search for it where? The Find feature of the regedit rarely works, it seems.

  4. Even going nuclear on the regedit isn’t working here. For some reason I couldn’t find the appid reflected in the registry either so I deleted them all. I also deleted all GSR entries, restarted the machine, etc – the company portal’s app is still “Installing….”

    “Luckily” I am going home so it will be fixed on monday, but it’s extremely frustrating when it gets stuck

  5. Hello,

    The script was not working for me too. MAybe logs have changed.
    So I try to modify it. It seems work on my problem that I had.

    Thanks for your blog post Rudy by the way. ๐Ÿ˜‰ Very usefull.

    Just for explain our case. We have an app (SAP) that need Excel to install. But we have several differents win 32 apps for Office (Office 365, Office 2021, with access, without access…) so we can’t use dependencies. And sometimes SAP try ton install before Office so we need to wait 24h for SAP to install…

    I am not a Powershell export, that’s why there is no more REGEX… So be conciliatory please. ๐Ÿ˜‰

    Just replace the appid by your app id :
    $appId = “a1d259fe-685d-4f75-bd6b-2785f9bb3688”

    $intuneLogList = Get-ChildItem -Path “$env:ProgramData\Microsoft\IntuneManagementExtension\Logs” -Filter “IntuneManagementExtension*.log” -File | sort LastWriteTime -Descending | select -ExpandProperty FullName

    if (!$intuneLogList) {
    Write-Error “Unable to find any Intune log files. Redeploy will probably not work as expected.”
    return
    }

    foreach ($intuneLog in $intuneLogList) {
    $appMatch = Select-String -Path $intuneLog -Pattern “\[Win32App\]\[GRSManager\] App with id: $appId is not expired.” -Context 0, 1
    if ($appMatch) {
    foreach ($match in $appMatch) {
    $Hash = “”
    $LineNumber = 0
    $LineNumber = $match.LineNumber
    $Hash = Get-Content $intuneLog | Select-Object -Skip $LineNumber -First 1
    if ($hash) {
    Write-Host $Hash
    }
    }
    }
    }

  6. The ‘+’ symbol in the returned has would break the regex search, i added the following to make it work for me.

    if ($hash) {
    $hash = $hash.Replace(‘+’,’\+’)
    return $hash
    }

  7. Another updated script (25jan2023)
    param(
    [String]$AppId = ”
    )

    if ([string]::IsNullOrEmpty($AppId)) {
    Write-Host “Parameter -AppId should have a value, it is empty or null”
    return 1
    }

    function _getAppGRSHash {
    param (
    [Parameter(Mandatory = $true)]
    [string] $appId
    )

    $intuneLogList = Get-ChildItem -Path “$env:ProgramData\Microsoft\IntuneManagementExtension\Logs” -Filter “IntuneManagementExtension*.log” -File | Sort-Object LastWriteTime -Descending | Select-Object -ExpandProperty FullName

    if (!$intuneLogList) {
    Write-Error “Unable to find any Intune log files. Redeploy will probably not work as expected.”
    return
    }

    foreach ($intuneLog in $intuneLogList) {
    $patt = “\[Win32App\]\[GRSManager\] Found GRS value:.+\\GRS\\(.+)\\$appId\.\]”
    $appMatch = Select-String -Path $intuneLog -Pattern $patt

    if ($appMatch) {
    foreach ($match in $appMatch) {
    Write-Host “Log Entry: $match”
    $hash = ([regex]”$patt”).Matches($match).captures.groups[1].value
    if ($hash) {
    return $hash
    }
    }
    }
    }

    Write-Error “Unable to find App ‘$appId’ GRS hash in any of the Intune log files. Redeploy will probably not work as expected”
    }

    [String]$grsHash = _getAppGRSHash -appId $AppId
    Write-Host “App ID: $AppId”
    Write-Host “GRS Key: $grsHash”

Leave a Reply

Your email address will not be published. Required fields are marked *

20  +    =  21