Block-ADTAppExecution
SYNOPSIS
Block the execution of an application(s).
SYNTAX
Block-ADTAppExecution [-ProcessName] <String[]> [<CommonParameters>]
DESCRIPTION
This function is called when you pass the -BlockExecution parameter to the Stop-RunningApplications function. It does the following:
- Makes a copy of this script in a temporary directory on the local machine.
- Checks for an existing scheduled task from previous failed installation attempt where apps were blocked and if found, calls the Unblock-ADTAppExecution function to restore the original IFEO registry keys. This is to prevent the function from overriding the backup of the original IFEO options.
- Creates a scheduled task to restore the IFEO registry key values in case the script is terminated uncleanly by calling
Unblock-ADTAppExecution
the local temporary copy of this module. - Modifies the "Image File Execution Options" registry key for the specified process(s) to call
Show-ADTInstallationPrompt
with the appropriate messaging via this module. - When the script is called with those parameters, it will display a custom message to the user to indicate that execution of the application has been blocked while the installation is in progress. The text of this message can be customized in the strings.psd1 file.
EXAMPLES
EXAMPLE 1
Block-ADTAppExecution -ProcessName ('winword','excel')
This example blocks the execution of Microsoft Word and Excel.
PARAMETERS
-ProcessName
Name of the process or processes separated by commas.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
None
You cannot pipe objects to this function.
OUTPUTS
None
This function does not generate any output.
NOTES
An active ADT session is required to use this function.
It is used when the -BlockExecution parameter is specified with the Show-ADTInstallationWelcome function to block applications.
Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0
RELATED LINKS
https://psappdeploytoolkit.com/docs/reference/functions/Block-ADTAppExecution