Is there anyway to set the retry times when a user hits “defer” for when the app is installing from intune?
A required installation for instance, when a user hits defer it retries within one minute. I can see this being annoying for a normal user.
One way around it is to set 60012 as a failure and then intune will retry within 8 hours three times but, ideally, we dont want to set this as a failure.
Hi,
With PSADT v3.10 (and earlier) in our experience the deferral appeared in the Intune Portal as a failure with the Status detail (Hex Code): 0x8007EA6C
For us the retry occurs (By default) after 8 hours - generally the next day
I’m happy to accept these failures as I know that eventually they will succeed when the users deferrals have run out (3 times in my case)
Not that this matters, but the above screen grab is for Firefox, for which I use the following (PSADT 3.10) Show-InstallationWelcome
command
Show-InstallationWelcome -CloseApps 'Firefox=Mozilla Firefox' -MinimizeWindows $false -AllowDeferCloseApps -DeferTimes 3 -CheckDiskSpace -PersistPrompt -TopMost $true
2 Likes
Gordy_B
January 14, 2025, 10:51am
3
Thanks for the reply, in SCCM there is an option to determine the deployment based on exit codes and i noticed this wasnt set in intune.
Going to try that to see how that behaves (no pun intended) however, we will just accept the exit code 60012 as a failure to stop the instant retries if that doesnt work.
Just wanted to see if there was a way to set the retry time.
Someone’s sent through a PR to help with this and it looks good. I’m waiting for a co-developer to peer review it also before we get it in for 4.1.0.
PSAppDeployToolkit:develop
← tjgruber:develop
opened 06:49PM - 12 Jan 25 UTC
#### **Overview**
This PR introduces a new parameter, `-DeferRunInterval`, to t… he `PSAppDeployToolkit` (`Show-ADTInstallationWelcome` and related functions). The feature aims to mitigate repetitive installation attempts by Intune after a user defers an installation, enhancing the overall user experience.
This is a minimally invasive but effective way that addresses the issue.
#### **Key Changes**
1. **New Parameter Added:**
- `DeferRunInterval` (as **_System.TimeSpan_**): Specifies the interval before re-prompting the user after a deferral.
- Improves user experience by avoiding multiple immediate retries caused by Intune's default behavior.
- Seamlessly integrates with the existing deferral workflow in `Show-ADTInstallationWelcome`.
2. **Updated Functions:**
- **`Set-ADTDeferHistory`**: Supports saving and retrieving the `DeferRunInterval` and the last deferral timestamp (`DeferRunIntervalLastTime`).
- **`Show-ADTInstallationWelcome`**: Logic added to:
- Check if the deferral interval has elapsed.
- Exit gracefully if the interval has not yet elapsed.
3. **Changes in `PSADT.Module.Class.DeploymentSession.cs`:**
- Added logic to handle the new parameters: `DeferRunInterval` and `DeferRunIntervalLastTime`.
#### **Test Cases**
All test scenarios were validated successfully:
1. **With `DeferRunInterval` Specified**:
- Prevents repeated prompts during the specified interval.
2. **Without `DeferRunInterval` Specified**:
- Falls back to default deferral logic without affecting the user experience.
3. **Emergency Update Scenario**:
- If `-DeferRunInterval` is not specified in a subsequent deployment, existing entries in the registry do not interfere with prompting users.
4. **TestLocal**:
- The 'TestLocal' test in VSCode passed successfully.
5. **Local Build**:
- Module built and tested locally with expected results successfully.
#### **Behavioral Improvements**
- Enhanced flexibility for deployments managed through Intune.
- Significant reduction in redundant prompts, leading to better user satisfaction.
#### **Log Outputs**
Clear and actionable log messages added to track `DeferRunInterval` behavior:
- Recording of `DeferRunInterval` and `DeferRunIntervalLastTime`.
- Logging checks for elapsed intervals and graceful exits.
#### **Backward Compatibility**
The changes are fully backward-compatible:
- If `-DeferRunInterval` is not specified, the toolkit functions as before.
---
Let me know if you'd like further tweaks or have any questions!
---
Examples used for logs below:
```powershell
Show-ADTInstallationWelcome -CloseProcesses 'code' -Subtitle 'Application Update' -AllowDeferCloseProcesses -CheckDiskSpace -ForceCloseProcessesCountdown 3270 -NoMinimizeWindows -DeferDays 5 -DeferRunInterval ([System.TimeSpan]::FromHours(24))
Show-ADTInstallationWelcome -CloseProcesses 'code' -Subtitle 'Application Update' -AllowDeferCloseProcesses -CheckDiskSpace -ForceCloseProcessesCountdown 3270 -NoMinimizeWindows -DeferDays 5
```
---
Logging examples:
```
# Test Case: (First run with `-DeferRunInterval ([System.TimeSpan]::FromHours(24))` specified)
<![LOG[[Pre-Install] :: The following processes are running: [Code].]LOG]!>
<![LOG[[Pre-Install] :: DeferRunInterval of [1.00:00:00] is specified. Checking DeferRunIntervalLastTime.]LOG]!>
<![LOG[[Pre-Install] :: Installation deferred by the user.]LOG]!>
<![LOG[[Pre-Install] :: Converting the date [2025-01-13 12:30:52] to a universal sortable date time pattern based on the current culture [en-US].]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferTimesRemaining = 0].]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferDeadline = 2025-01-18 12:30:46Z].]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferRunInterval = 1.00:00:00].]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferRunIntervalLastTime = 2025-01-13 20:30:52Z].]LOG]!>
<![LOG[[Finalization] :: [PSAppDeployToolkit_4.1.0_EN_01] install completed with exit code [60012].]LOG]!>
# Test Case: (Immediate subsequent run mimicking Intune retry after user deferral)
<![LOG[[Pre-Install] :: The following processes are running: [Code].]LOG]!>
<![LOG[[Pre-Install] :: DeferRunInterval of [1.00:00:00] is specified. Checking DeferRunIntervalLastTime.]LOG]!>
<![LOG[[Pre-Install] :: Converting the date [2025-01-13 20:30:52Z] to a universal sortable date time pattern based on the current culture [en-US].]LOG]!>
<![LOG[[Pre-Install] :: Converting the date [2025-01-14 12:30:52Z] to a universal sortable date time pattern based on the current culture [en-US].]LOG]!>
<![LOG[[Pre-Install] :: Converting the date [2025-01-13 12:31:08] to a universal sortable date time pattern based on the current culture [en-US].]LOG]!>
<![LOG[[Pre-Install] :: DeferRunInterval has not elapsed. Exiting gracefully.]LOG]!>
<![LOG[[Finalization] :: [PSAppDeployToolkit_4.1.0_EN_01] install completed with exit code [1618].]LOG]!>
# Test Case: (User deferral without `-DeferRunInterval ([System.TimeSpan]::FromHours(24))` specified)
<![LOG[[Pre-Install] :: The following processes are running: [Code].]LOG]!>
<![LOG[[Pre-Install] :: Installation deferred by the user.]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferTimesRemaining = 0].]LOG]!>
<![LOG[[Pre-Install] :: Setting deferral history: [DeferDeadline = 2025-01-18 12:30:46Z].]LOG]!>
<![LOG[[Finalization] :: [PSAppDeployToolkit_4.1.0_EN_01] install completed with exit code [60012].]LOG]!>
# Test Case: (`-DeferRunInterval ([System.TimeSpan]::FromHours(24))` is specified but process is not running)
<![LOG[[Pre-Install] :: Specified applications are not running.]LOG]!>
<![LOG[[Pre-Install] :: Creating the progress dialog in a separate thread with message: [Installation in progress. Please wait...].]LOG]!>
<![LOG[[Post-Install] :: Displaying custom installation prompt asynchronously with the parameters: [-Message:'You can customize...].]LOG]!>
<![LOG[[Finalization] :: Closing the installation progress dialog.]LOG]!>
<![LOG[[Finalization] :: Removing deferral history...]LOG]!>
<![LOG[[Finalization] :: [PSAppDeployToolkit_4.1.0_EN_01] install completed with exit code [0].]LOG]!>
```
2 Likes
I just remembered I had replied to something similar about deferal codes in Oct '23, this ‘might’ give you some ideas:
Is there any place in the code I can catch a deferral before it exits?
So user clicks the defer button and I want to do some custom code before exit… how/where would I be able to do that.
and bonus points if anyone has code to set a scheduled task to make sure the deferral pops up daily since sccms isint great at that
Using PSADT 3.8.4
or the PR that @mjr4077au has just posted may be good too
3 Likes
Gordy_B
January 14, 2025, 12:15pm
6
This looks very good!
I will see what the intune setting does and if that doesnt give us the results we want, we will just accept them as failures until the PR is imbedded into a newer version of the tool kit.
2 Likes