Block-ADTAppExecution
SYNOPSIS
Block the execution of an application(s).
SYNTAX
Block-ADTAppExecution [-Processes] <ProcessDefinition[]> [[-WindowLocation] <DialogPosition>]
[<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-ADTAppExecutionthe local temporary copy of this module. - Modifies the "Image File Execution Options" registry key for the specified process(s) to call
Show-ADTInstallationPromptwith 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 -Processes ('winword','excel')
This example blocks the execution of Microsoft Word and Excel.
PARAMETERS
-Processes
Name of the process or processes separated by commas.
Type: ProcessDefinition[]
Parameter Sets: (All)
Aliases: ProcessName
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WindowLocation
The location of the dialog on the screen.
Type: DialogPosition
Parameter Sets: (All)
Aliases:
Accepted values: Default, TopLeft, Top, TopRight, TopCenter, Center, BottomLeft, Bottom, BottomRight, BottomCenter
Required: False
Position: 2
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