Show-DeferPrompt [old version]

Full toolkit reworked with added custom defer prompt with selectable defer time units.

https://onedrive.live.com/redir?resid=56CBE4F90DCC5A1A!4259&authkey=!APyxljPT5R-T3Gc&e=gMXKMY

**WARNING from Moderator: **

Source file is now missing

We may now have to require posting extension code here or github

3 Likes

Sample Image:

2 Likes

Very Nice, Thank you for sharing, I did run into an issue with Defers not working though.
Turns out the script is trying to create a reg key here:

HKEY_LOCAL_MACHINE\SOFTWARE\Deferral\AppDefer

When I would run the script multiple times, the same deferral count would show. After looking at the console, it showed the ā€œDeferralā€ key didnā€™t exist so it couldnā€™t create the ā€œAppDeferā€ key.

I added these lines to the AppDeployToolkitExtensions.PS1 file to resolve the issue

$RegRoot = ā€œHKLM:\SOFTWARE\Deferralā€
New-Item -Path $RegRoot -ErrorAction SilentlyContinue

Here is where I added them:

if($ShowBalloon -eq $true) {
Show-BalloonTip -BalloonTipText ā€œInstallation deferred for $DeferTime $HrMinā€
}
# Add new registry key and value for defer count
$RegRoot = ā€œHKLM:\SOFTWARE\Deferralā€
$RegPath = ā€œHKLM:\SOFTWARE\Deferral\AppDeferā€
$name = ā€œDeferCount-$appNameā€
$newvalue = $DeferLimit
$type = ā€œStringā€
$localvalue = Get-ItemProperty -Path $RegPath -Name $name -ErrorAction SilentlyContinue | > Select -ExpandProperty $name
# If the deferral reg key exists and itā€™s not equal to ā€˜0ā€™, decrement the value by 1
if(($localvalue -ne $null) -and ($localvalue -ne 0)) {
Write-Host ā€˜found valueā€™
$localvalue = $localvalue -1
Set-ItemProperty -Path $RegPath -Name $name -Value $localvalue
}
# If the If the deferral reg key is equal to ā€˜0ā€™, start the standard installation script section
elseif($localvalue -eq 0) {}
# If the deferral reg key doesnā€™t exist, create it with the default value and decrement by 1
else {
New-Item -Path $RegRoot -ErrorAction SilentlyContinue
New-Item -Path $RegPath -ErrorAction SilentlyContinue
Set-ItemProperty -Path $RegPath -Name $name -Value $newvalue
$localvalue = (Get-ItemProperty -Path $RegPath -Name $name).$name
$localvalue = $localvalue -1
Set-ItemProperty -Path $RegPath -Name $name -Value $localvalue
}

Hopefully you can add this or something similar back to your source code or if someone else is running into this issue they can fix it using this code.

Also, Does your Defer Prompt have a countdown? I use this heavily for unattended machines and it would be a great feature to have. Thanks!

2 Likes

Good catch @king13p! I probably already had that reg key so I never ran into those issues. Iā€™ll try and get it updated in the download soon.
I didnā€™t even think of the countdown optionā€¦ Something to consider looking into for sure.

1 Like

Hi @FoldZan1,

A big thank you for sharing. I have been waiting for something like this but like @king13p would like to have a countdown so we can use the same package for both unattended lab install and staff updates so just registering a +1 for the countdown from me.

Cheers!

1 Like

@king13p I updated the share with this code.

1 Like

Great! Thanks.

One other question, I didnā€™t do a test of this for a standard user yet but it may be an issue. If a user selects defer, it creates a scheduled task for the user. Once the time hits and the task runs, UAC pops up trying to launch PowerShell. Iā€™ll attempt to test it this week with a standard user but I believe you can run the scheduled task as NT AUTHORITY\SYSTEM to resolve this issue. The issue would be UAC will request a standard user to put in elevated credentials our users donā€™t have. If I have time today Iā€™ll verify. Thanks

2 Likes

Hello All,

Thank for providing the updated package,

I am not able to produce defer while deploying this application via SCCM, on the other hand when i run this manually, the defer is coming up.

Please provide your valuable advice as i am stuck with this quite long.

Best Regards
Ravi Kumar

Hi, I am trying to use the tool provided by FoldZan1, however have run into an issue whereby after deferring the deployment for 30 mins it popped with a dialog box to allow PowerShell to run first before launching the Defer -Prompt Window.
Can someone advise how to fix the PowerShell popup.
Thks

It could have to do with your environment setup of UAC or the default PowerShell execution policy. Try changing the execution policy to bypass in the command in the scheduled task that the defer creates to run it again in 30 minutes.

In SCCM, are you creating the application to Run as User or System? Youā€™d have to set it to run as User.

Hi FoldZan1 . Thanks for your quick reply. I was testing the app locally but will upload to sccm and try with the option ā€˜Install for userā€™ rather than ā€˜install for Systemā€™ā€¦

Unfortunately Iā€™ve tested in sccm with the application set to ā€˜run as userā€™ and this prompts for admin credentials to open PowerShell. Can you advise how best to resolve the issue ?, as I would like to use the Defer-Prompt option provided. Thks

This good, but how do I get it to show a countdown and force close the apps that need closing so the process will auto continue? Show-deferprompt does not seem to accept the -ForceCloseAppsCountdown paramater.
The objective is for the process to continue if there isnā€™t a user present otherwise the without the countdown the process will just sit there.

I have this almost working with Intune. Iā€™ve just started using PSADT so Iā€™m still learning my way around. The task is created and is set to run the Deploy-Application.exe from the IMECache but the IMECache clears after the deferment has been set. I understand this is how the cache works but is any ideas on how to work around this? Appreciate the help.

I am unable to download from one-drive, please help me to download it

@FoldZan1 I am unable to download from one-drive, please help me to download it

@FoldZan1
I am looking for the same, is it possible to reupload the script.

ThankQ.!

1 Like

@FoldZan1 Can you please re-share?

I Found FoldZan1 on Github with the code posted: GitHub - foldzan1/PSADT-Extensions

1 Like