Defer and set reinstall at 12pm

Hi , I can’t find the script at the location, has it been moved/deleted. We have a similar requirement from our client and need to give similar deer option as you the above one.

If you create a share I can send it to you.

1 Like

I will create a share and update you’

I certainly understand the points you’re making… I just chose to accept the failure since I knew it would be “known” based on my specified error code. With the defer option I created, it sends a code back so I can monitor that specific code. And even if SCCM does happen to repush the app before the deferral time selection, it will simply reduce the ‘remaining deferrals’ by one and keep going. And alternatively, if the user had finished the install through the deferral scheduled task prior to the repush, SCCM would just flip that failure into a success.
• If a ‘Defer’ is selected, it will create a scheduled task to rerun the installation from the source location (usually in ccmcache) at the specified time.
• A ‘runonce’ key is also created if the end user happens to reboot the machine prior to the scheduled task run time.
• It will also send an exit code of ‘60012’ back to SCCM and will show as a “failure”. This way, you’ll know in your SCCM monitoring that all 60012 failure codes are not actual failures. SCCM will automatically repush to the ‘failed’ machines (usually after 2 days)
Picture1

You can also change the software reevalualtion , period to 3 hours or no of days so that they get the prompt for Installation, once the reevaluation policy is triggered , they ll get the prompt for install or defer.

1 Like

Would you mind sending me a copy as well? I can provide a share location.

@FoldZan1 , thanks for sharing, did you only have to modify Deploy-Application.ps1 and did not have to update or touch AppDeployToolkitMain.ps1, AppDeployToolkitExtensions.ps1 and AppDeployToolkitHelp.ps1?

I included a word doc with what was modified/added in the zip file.

Essentially…
Functions added in the <AppDeployToolkitExtensions.ps1> file:

  1. Get-DeferTaskStatus
  2. Get-DeploymentProcess
  3. Show-DeferPrompt

Functions modified in the <AppDeployToolkitMain.ps1> file:

  1. Show-InstallationPrompt
  2. Show-WelcomePrompt

Thanks @FoldZan1, I have the Defer Demo you had uploaded and only changed the exe file in the Files folder then only changed the values of Viscosity in the Deploy-Application.ps1 and did not touch AppDeployToolkitMain.ps1, AppDeployToolkitExtensions.ps1 and AppDeployToolkitHelp.ps1. The behavior was PSADT notification popped up asking the user to Close Programs and I do not see the Defer options. Should I be updating the values of the app I am trying to install in AppDeployToolkitMain.ps1, AppDeployToolkitExtensions.ps1 and AppDeployToolkitHelp.ps1?
Screen Shot 2022-03-03 at 10.33.52 AM

So you modified the *.ps1 to look something like this?

 Get-DeploymentProcess -Name "viscosity"
        #=================================================================================>  
        # In some cases you will need to have a custom description because the vendor sucks. 
        # Use both lines below to do this. You will also have to specify individually (comma separated) in the 'Show-InstallationWelcome' line instead of using the $ProcessNames variable.
        #[switch]$UseCustomNames = $true
        #$CustomNames = "Microsoft Excel"  # Example: "Microsoft Word,Microsoft Excel"
        #=================================================================================> 
        
        ## <Show the 'Defer' prompt for the installation. NOTE: Only shows if one of the required closed apps is open.>
        # Example: Show-DeferPrompt -DeferLimit 2[default] -NetworkRequired '<computer name>' -ShowBalloon $True[default]/$False -TopMostDefer $True[default]/$False -ShowMinimizeButton $True/$False[default]  (Parameters are not required)
        Show-DeferPrompt

		## Show Welcome Message, close open apps if required
        Show-InstallationWelcome -CloseApps "$ProcessNames" -BlockExecution -MinimizeWindows $False
        #Show-InstallationWelcome -CloseApps "Notepad,Excel=Microsoft Excel" -MinimizeWindows $false -TopMost $true -BlockExecution

I only modified the Deploy-application.ps1 and added the new Viscosity version 1.10.1 exe installer in the Files folder

Notification pops up without Deferral option and then
when I click on Close Program it closes Viscosity then it says it is uninstalling Viscosity then it says uninstallation is completed and it did not really uninstall the old version of Viscosity 1.9.4 and installation of the new Viscosity 1.10.1 failed and I still have the old Viscosity 1.9.4

Note: I am deploying Viscosity and PSADT via VMWare Workspace one Please see attached screenshots

Screen Shot 2022-03-03 at 11.02.07 AM



Please see Deploy-application.ps1 below

<#
.SYNOPSIS
	This script performs the installation or uninstallation of an application(s).
	# LICENSE #
	PowerShell App Deployment Toolkit - Provides a set of functions to perform common application deployment tasks on Windows.
	Copyright (C) 2017 - Sean Lillis, Dan Cunningham, Muhammad Mashwani, Aman Motazedian.
	This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
	You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
.DESCRIPTION
	The script is provided as a template to perform an install or uninstall of an application(s).
	The script either performs an "Install" deployment type or an "Uninstall" deployment type.
	The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
	The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
.PARAMETER DeploymentType
	The type of deployment to perform. Default is: Install.
.PARAMETER DeployMode
	Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
.PARAMETER AllowRebootPassThru
	Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered.
.PARAMETER TerminalServerMode
	Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
.PARAMETER DisableLogging
	Disables logging to file for the script. Default is: $false.
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeployMode 'Silent'; Exit $LastExitCode }"
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -AllowRebootPassThru; Exit $LastExitCode }"
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeploymentType 'Uninstall'; Exit $LastExitCode }"
.EXAMPLE
    Deploy-Application.exe -DeploymentType "Install" -DeployMode "Silent"
.NOTES
	Toolkit Exit Code Ranges:
	60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
	69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1
	70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
.LINK
	http://psappdeploytoolkit.com
#>
[CmdletBinding()]
Param (
	[Parameter(Mandatory=$false)]
	[ValidateSet('Install','Uninstall','Repair')]
	[string]$DeploymentType = 'unInstall',
	[Parameter(Mandatory=$false)]
	[ValidateSet('Interactive','Silent','NonInteractive')]
	[string]$DeployMode = 'Interactive',
	[Parameter(Mandatory=$false)]
	[switch]$AllowRebootPassThru = $false,
	[Parameter(Mandatory=$false)]
	[switch]$TerminalServerMode = $false,
	[Parameter(Mandatory=$false)]
	[switch]$DisableLogging = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ShowDeferTime = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ChangePromptSize = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ButtonEnable = $true,
    [switch]$UseCustomNames = $false
)

Try {
	## Set the script execution policy for this process
	Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}

	##*===============================================
	##* VARIABLE DECLARATION
	##*===============================================
	## Variables: Application
	[string]$appVendor = ''
	[string]$appName = 'Viscosity'
    [string]$appNameDefer = "$appName" #<-do not change>
	[string]$appVersion = '1.10.1.1749'
	[string]$appArch = ''
	[string]$appLang = 'EN'
	[string]$appRevision = '01'
	[string]$appScriptVersion = '1.0.0'
	[string]$appScriptDate = '03/03/2022'
	[string]$appScriptAuthor = '<>'
	##*===============================================
	## Variables: Install Titles (Only set here to override defaults set by the toolkit)
	[string]$installName = ''
	[string]$installTitle = ''

	##* Do not modify section below
	#region DoNotModify

	## Variables: Exit Code
	[int32]$mainExitCode = 0

	## Variables: Script
	[string]$deployAppScriptFriendlyName = 'Deploy Application'
	[version]$deployAppScriptVersion = [version]'1.0.0'
	[string]$deployAppScriptDate = '03/03/2022'
	[hashtable]$deployAppScriptParameters = $psBoundParameters

	## Variables: Environment
	If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
	[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent

	## Dot source the required App Deploy Toolkit Functions
	Try {
		[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
		If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
		If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
	}
	Catch {
		If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
		Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
		## Exit the script, returning the exit code to SCCM
		If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
	}

	#endregion
	##* Do not modify section above
	##*===============================================
	##* END VARIABLE DECLARATION
	##*===============================================

	If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
		##*===============================================
		##* PRE-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Installation'
        
        ## <Perform Pre-Installation tasks here>
        ## <Enter the processes you need closed below separated by a comma.
        # Example: Get-DeploymentProcess -Name "notepad,iexplore,winword"
        #=================================================================================>  
        Get-DeploymentProcess -Name "viscosity"
        #=================================================================================>  
        # In some cases you will need to have a custom description because the vendor sucks. 
        # Use both lines below to do this. You will also have to specify individually (comma separated) in the 'Show-InstallationWelcome' line instead of using the $ProcessNames variable.
        #[switch]$UseCustomNames = $true
        #$CustomNames = "Microsoft Excel"  # Example: "Microsoft Word,Microsoft Excel"
        #=================================================================================> 
        
        ## <Show the 'Defer' prompt for the installation. NOTE: Only shows if one of the required closed apps is open.>
        # Example: Show-DeferPrompt -DeferLimit 2[default] -NetworkRequired '<computer name>' -ShowBalloon $True[default]/$False -TopMostDefer $True[default]/$False -ShowMinimizeButton $True/$False[default]  (Parameters are not required)
        Show-DeferPrompt

		## Show Welcome Message, close open apps if required
        Show-InstallationWelcome -CloseApps "$ProcessNames" -BlockExecution -MinimizeWindows $False
        #Show-InstallationWelcome -CloseApps "Viscosity" -MinimizeWindows $false -TopMost $true -BlockExecution

		## Show Progress Message (with the default message)
        Show-InstallationProgress -StatusMessage "Installing Software.  Please Wait...."

        ## <Perform Pre-Installation tasks here>
        Start-Sleep -Seconds '15' #line used for testing



		##*===============================================
		##* INSTALLATION
		##*===============================================
		[string]$installPhase = 'Installation'

		## Handle Zero-Config MSI Installations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
		}

		## <Perform Installation tasks here>



		##*===============================================
		##* POST-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Installation'

		## <Perform Post-Installation tasks here>
        



		## Display a message at the end of the install
		If (-not $useDefaultMsi) { <#Show-InstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait#> }
	}
	ElseIf ($deploymentType -ieq 'Uninstall')
	{
		##*===============================================
		##* PRE-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Uninstallation'
        [string]$configClosePromptMessage = "The following programs must be closed before uninstallation can proceed:

		  Please save your work, close the programs, and click 'Continue'.
		  Alternatively, save your work and click 'Close Programs'."
        


		## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
		Show-InstallationWelcome -CloseApps "Viscosity"

		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Uninstallation tasks here>
        Start-Sleep -Seconds '5' #line used for testing


		##*===============================================
		##* UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Uninstallation'

		## Handle Zero-Config MSI Uninstallations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat
		}

		# <Perform Uninstallation tasks here>



		##*===============================================
		##* POST-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Uninstallation'

		## <Perform Post-Uninstallation tasks here>


	}
	ElseIf ($deploymentType -ieq 'Repair')
	{
		##*===============================================
		##* PRE-REPAIR
		##*===============================================
		[string]$installPhase = 'Pre-Repair'

		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Repair tasks here>

		##*===============================================
		##* REPAIR
		##*===============================================
		[string]$installPhase = 'Repair'

		## Handle Zero-Config MSI Repairs
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Repair'; Path = $defaultMsiFile; }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat
		}
		# <Perform Repair tasks here>

		##*===============================================
		##* POST-REPAIR
		##*===============================================
		[string]$installPhase = 'Post-Repair'

		## <Perform Post-Repair tasks here>


    }
	##*===============================================
	##* END SCRIPT BODY
	##*===============================================

	## Call the Exit-Script function to perform final cleanup operations
	Exit-Script -ExitCode $mainExitCode
}
Catch {
	[int32]$mainExitCode = 60001
	[string]$mainErrorMessage = "$(Resolve-Error)"
	Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
	Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
	Exit-Script -ExitCode $mainExitCode
}

Ohhhh this was MY fault! I see in your script you have this set to “uninstall”. Change it to “install”. My fault since I was testing stuff out and forgot to change it back…

image

Thanks, let me try that

I just changed the $DeploymentType = ‘Install’

and now notification did not even show up. Again, I appreciate your help @FoldZan1

Please see the script below:

<#
.SYNOPSIS
	This script performs the installation or uninstallation of an application(s).
	# LICENSE #
	PowerShell App Deployment Toolkit - Provides a set of functions to perform common application deployment tasks on Windows.
	Copyright (C) 2017 - Sean Lillis, Dan Cunningham, Muhammad Mashwani, Aman Motazedian.
	This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
	You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
.DESCRIPTION
	The script is provided as a template to perform an install or uninstall of an application(s).
	The script either performs an "Install" deployment type or an "Uninstall" deployment type.
	The install deployment type is broken down into 3 main sections/phases: Pre-Install, Install, and Post-Install.
	The script dot-sources the AppDeployToolkitMain.ps1 script which contains the logic and functions required to install or uninstall an application.
.PARAMETER DeploymentType
	The type of deployment to perform. Default is: Install.
.PARAMETER DeployMode
	Specifies whether the installation should be run in Interactive, Silent, or NonInteractive mode. Default is: Interactive. Options: Interactive = Shows dialogs, Silent = No dialogs, NonInteractive = Very silent, i.e. no blocking apps. NonInteractive mode is automatically set if it is detected that the process is not user interactive.
.PARAMETER AllowRebootPassThru
	Allows the 3010 return code (requires restart) to be passed back to the parent process (e.g. SCCM) if detected from an installation. If 3010 is passed back to SCCM, a reboot prompt will be triggered.
.PARAMETER TerminalServerMode
	Changes to "user install mode" and back to "user execute mode" for installing/uninstalling applications for Remote Destkop Session Hosts/Citrix servers.
.PARAMETER DisableLogging
	Disables logging to file for the script. Default is: $false.
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeployMode 'Silent'; Exit $LastExitCode }"
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -AllowRebootPassThru; Exit $LastExitCode }"
.EXAMPLE
    powershell.exe -Command "& { & '.\Deploy-Application.ps1' -DeploymentType 'Uninstall'; Exit $LastExitCode }"
.EXAMPLE
    Deploy-Application.exe -DeploymentType "Install" -DeployMode "Silent"
.NOTES
	Toolkit Exit Code Ranges:
	60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
	69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1
	70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
.LINK
	http://psappdeploytoolkit.com
#>
[CmdletBinding()]
Param (
	[Parameter(Mandatory=$false)]
	[ValidateSet('Install','Uninstall','Repair')]
	[string]$DeploymentType = 'Install',
	[Parameter(Mandatory=$false)]
	[ValidateSet('Interactive','Silent','NonInteractive')]
	[string]$DeployMode = 'Interactive',
	[Parameter(Mandatory=$false)]
	[switch]$AllowRebootPassThru = $false,
	[Parameter(Mandatory=$false)]
	[switch]$TerminalServerMode = $false,
	[Parameter(Mandatory=$false)]
	[switch]$DisableLogging = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ShowDeferTime = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ChangePromptSize = $false,
    [Parameter(Mandatory=$false)]
    [switch]$ButtonEnable = $true,
    [switch]$UseCustomNames = $false
)

Try {
	## Set the script execution policy for this process
	Try { Set-ExecutionPolicy -ExecutionPolicy 'ByPass' -Scope 'Process' -Force -ErrorAction 'Stop' } Catch {}

	##*===============================================
	##* VARIABLE DECLARATION
	##*===============================================
	## Variables: Application
	[string]$appVendor = ''
	[string]$appName = 'Viscosity'
    [string]$appNameDefer = "$appName" #<-do not change>
	[string]$appVersion = '1.10.1.1749'
	[string]$appArch = ''
	[string]$appLang = 'EN'
	[string]$appRevision = '01'
	[string]$appScriptVersion = '1.0.0'
	[string]$appScriptDate = '03/03/2022'
	[string]$appScriptAuthor = '<>'
	##*===============================================
	## Variables: Install Titles (Only set here to override defaults set by the toolkit)
	[string]$installName = ''
	[string]$installTitle = ''

	##* Do not modify section below
	#region DoNotModify

	## Variables: Exit Code
	[int32]$mainExitCode = 0

	## Variables: Script
	[string]$deployAppScriptFriendlyName = 'Deploy Application'
	[version]$deployAppScriptVersion = [version]'1.0.0'
	[string]$deployAppScriptDate = '03/03/2022'
	[hashtable]$deployAppScriptParameters = $psBoundParameters

	## Variables: Environment
	If (Test-Path -LiteralPath 'variable:HostInvocation') { $InvocationInfo = $HostInvocation } Else { $InvocationInfo = $MyInvocation }
	[string]$scriptDirectory = Split-Path -Path $InvocationInfo.MyCommand.Definition -Parent

	## Dot source the required App Deploy Toolkit Functions
	Try {
		[string]$moduleAppDeployToolkitMain = "$scriptDirectory\AppDeployToolkit\AppDeployToolkitMain.ps1"
		If (-not (Test-Path -LiteralPath $moduleAppDeployToolkitMain -PathType 'Leaf')) { Throw "Module does not exist at the specified location [$moduleAppDeployToolkitMain]." }
		If ($DisableLogging) { . $moduleAppDeployToolkitMain -DisableLogging } Else { . $moduleAppDeployToolkitMain }
	}
	Catch {
		If ($mainExitCode -eq 0){ [int32]$mainExitCode = 60008 }
		Write-Error -Message "Module [$moduleAppDeployToolkitMain] failed to load: `n$($_.Exception.Message)`n `n$($_.InvocationInfo.PositionMessage)" -ErrorAction 'Continue'
		## Exit the script, returning the exit code to SCCM
		If (Test-Path -LiteralPath 'variable:HostInvocation') { $script:ExitCode = $mainExitCode; Exit } Else { Exit $mainExitCode }
	}

	#endregion
	##* Do not modify section above
	##*===============================================
	##* END VARIABLE DECLARATION
	##*===============================================

	If ($deploymentType -ine 'Uninstall' -and $deploymentType -ine 'Repair') {
		##*===============================================
		##* PRE-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Installation'
        
        ## <Perform Pre-Installation tasks here>
        ## <Enter the processes you need closed below separated by a comma.
        # Example: Get-DeploymentProcess -Name "notepad,iexplore,winword"
        #=================================================================================>  
        Get-DeploymentProcess -Name "viscosity"
        #=================================================================================>  
        # In some cases you will need to have a custom description because the vendor sucks. 
        # Use both lines below to do this. You will also have to specify individually (comma separated) in the 'Show-InstallationWelcome' line instead of using the $ProcessNames variable.
        #[switch]$UseCustomNames = $true
        #$CustomNames = "Microsoft Excel"  # Example: "Microsoft Word,Microsoft Excel"
        #=================================================================================> 
        
        ## <Show the 'Defer' prompt for the installation. NOTE: Only shows if one of the required closed apps is open.>
        # Example: Show-DeferPrompt -DeferLimit 2[default] -NetworkRequired '<computer name>' -ShowBalloon $True[default]/$False -TopMostDefer $True[default]/$False -ShowMinimizeButton $True/$False[default]  (Parameters are not required)
        Show-DeferPrompt

		## Show Welcome Message, close open apps if required
        Show-InstallationWelcome -CloseApps "$ProcessNames" -BlockExecution -MinimizeWindows $False
        #Show-InstallationWelcome -CloseApps "Viscosity" -MinimizeWindows $false -TopMost $true -BlockExecution

		## Show Progress Message (with the default message)
        Show-InstallationProgress -StatusMessage "Installing Software.  Please Wait...."

        ## <Perform Pre-Installation tasks here>
        Start-Sleep -Seconds '15' #line used for testing



		##*===============================================
		##* INSTALLATION
		##*===============================================
		[string]$installPhase = 'Installation'

		## Handle Zero-Config MSI Installations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
		}

		## <Perform Installation tasks here>



		##*===============================================
		##* POST-INSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Installation'

		## <Perform Post-Installation tasks here>
        



		## Display a message at the end of the install
		If (-not $useDefaultMsi) { <#Show-InstallationPrompt -Message 'You can customize text to appear at the end of an install or remove it completely for unattended installations.' -ButtonRightText 'OK' -Icon Information -NoWait#> }
	}
	ElseIf ($deploymentType -ieq 'Uninstall')
	{
		##*===============================================
		##* PRE-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Pre-Uninstallation'
        [string]$configClosePromptMessage = "The following programs must be closed before uninstallation can proceed:

		  Please save your work, close the programs, and click 'Continue'.
		  Alternatively, save your work and click 'Close Programs'."
        


		## Show Welcome Message, close Internet Explorer with a 60 second countdown before automatically closing
		Show-InstallationWelcome -CloseApps "Viscosity"

		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Uninstallation tasks here>
        Start-Sleep -Seconds '5' #line used for testing


		##*===============================================
		##* UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Uninstallation'

		## Handle Zero-Config MSI Uninstallations
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Uninstall'; Path = $defaultMsiFile }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
			Execute-MSI @ExecuteDefaultMSISplat
		}

		# <Perform Uninstallation tasks here>



		##*===============================================
		##* POST-UNINSTALLATION
		##*===============================================
		[string]$installPhase = 'Post-Uninstallation'

		## <Perform Post-Uninstallation tasks here>


	}
	ElseIf ($deploymentType -ieq 'Repair')
	{
		##*===============================================
		##* PRE-REPAIR
		##*===============================================
		[string]$installPhase = 'Pre-Repair'

		## Show Progress Message (with the default message)
		Show-InstallationProgress

		## <Perform Pre-Repair tasks here>

		##*===============================================
		##* REPAIR
		##*===============================================
		[string]$installPhase = 'Repair'

		## Handle Zero-Config MSI Repairs
		If ($useDefaultMsi) {
			[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Repair'; Path = $defaultMsiFile; }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat
		}
		# <Perform Repair tasks here>

		##*===============================================
		##* POST-REPAIR
		##*===============================================
		[string]$installPhase = 'Post-Repair'

		## <Perform Post-Repair tasks here>


    }
	##*===============================================
	##* END SCRIPT BODY
	##*===============================================

	## Call the Exit-Script function to perform final cleanup operations
	Exit-Script -ExitCode $mainExitCode
}
Catch {
	[int32]$mainExitCode = 60001
	[string]$mainErrorMessage = "$(Resolve-Error)"
	Write-Log -Message $mainErrorMessage -Severity 3 -Source $deployAppScriptFriendlyName
	Show-DialogBox -Text $mainErrorMessage -Icon 'Stop'
	Exit-Script -ExitCode $mainExitCode
}

@FoldZan1 Appreciate your efforts.
I have tried this, but as per your screenshot i’m not able to get Defer Tab with time as well as Install now Tab.
Could you tell me where do i need to change to get these TAB visible for me?
defer

Thank you! I will try it and will update here…

@FoldZan1 Thank you for this, now its working as per expectation.

1 Like

@FoldZan1 This one is configured in PSADT 3.8.2 version. But 3.8.2 version has some bugs and it not works in JAPAN, China countries as per my previous experience. Do you have this custom setup with 3.8.4?

Also i found that with this its works well on HYBRID joined devices. But when i tried out this on AAD joined devices its not creating defer task. I’m using INTUNE for this.

I haven’t built it into the latest version of PSADTK quite yet. I’ll try and do that when I have time but it takes a bit of work. Keep in mind this was something I did on my own. I’m not associated with the devs at all.

I’ve updated the toolkit to version 3.8.4.

1 Like