Skip to main content

Uninstall-ADTApplication

SYNOPSIS

Removes one or more applications specified by name, filter script, or InstalledApplication object from Get-ADTApplication.

SYNTAX

InstalledApplication

Uninstall-ADTApplication -InstalledApplication <InstalledApplication[]> [-ForceUninstallString]
[-ArgumentList <String[]>] [-AdditionalArgumentList <String[]>] [-SecureArgumentList]
[-LoggingOptions <String>] [-LogFileName <String>] [-WaitForChildProcesses] [-KillChildProcessesWithParent]
[-SuccessExitCodes <Int32[]>] [-RebootExitCodes <Int32[]>] [-IgnoreExitCodes <String[]>]
[-ExitOnProcessFailure] [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Uninstall-ADTApplication [-Name <String[]>] [-NameMatch <String>] [-ProductCode <Guid[]>]
[-ApplicationType <String>] [-IncludeUpdatesAndHotfixes] [[-FilterScript] <ScriptBlock>]
[-ForceUninstallString] [-ArgumentList <String[]>] [-AdditionalArgumentList <String[]>] [-SecureArgumentList]
[-LoggingOptions <String>] [-LogFileName <String>] [-WaitForChildProcesses] [-KillChildProcessesWithParent]
[-SuccessExitCodes <Int32[]>] [-RebootExitCodes <Int32[]>] [-IgnoreExitCodes <String[]>]
[-ExitOnProcessFailure] [-PassThru] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Uninstall-ADTApplication function removes one or more applications specified by name, filter script, or InstalledApplication object from Get-ADTApplication.

Enumerates the registry for installed applications via Get-ADTApplication, matching the specified application name and uninstalls that application using its uninstall string, with the ability to specify additional uninstall parameters also.

The application will be uninstalled using its QuietUninstallString where possible. If it doesn't exist, is null, is invalid, or -ForceUninstallString is specified, the UninstallString will be used.

EXAMPLES

EXAMPLE 1

Uninstall-ADTApplication -Name 'Acrobat' -ApplicationType 'MSI' -FilterScript { $_.Publisher -match 'Adobe' }

Removes all MSI applications that contain the name 'Acrobat' in the DisplayName and 'Adobe' in the Publisher name.

EXAMPLE 2

Uninstall-ADTApplication -Name 'Java' -FilterScript {$_.Publisher -eq 'Oracle Corporation' -and $_.Is64BitApplication -eq $true -and $_.DisplayVersion -notlike '8.*'}

Removes all MSI applications that contain the name 'Java' in the DisplayName, with Publisher as 'Oracle Corporation', are 64-bit, and not version 8.x.

EXAMPLE 3

Uninstall-ADTApplication -FilterScript {$_.DisplayName -match '^Vim\s'} -Verbose -ApplicationType EXE -ArgumentList '/S'

Remove all EXE applications starting with the name 'Vim' followed by a space, using the '/S' parameter.

PARAMETERS

-InstalledApplication

Specifies the [PSADT.AppManagement.InstalledApplication] object to remove. This parameter is typically used when piping the output of Get-ADTApplication to this function.

Type: InstalledApplication[]
Parameter Sets: InstalledApplication
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Name

The name of the application to retrieve information for. Performs a contains match on the application display name by default.

Type: String[]
Parameter Sets: Search
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-NameMatch

Specifies the type of match to perform on the application name.

Valid values for this parameter are:

  • Contains (default): Equivalent to $appDisplayName -like "*$Name*".
  • Exact: Equivalent to $appDisplayName -eq $Name.
  • Wildcard: Equivalent to $appDisplayName -like $Name.
  • Regex: Equivalent to $appDisplayName -match $Name.
Type: String
Parameter Sets: Search
Aliases:

Required: False
Position: Named
Default value: Contains
Accept pipeline input: False
Accept wildcard characters: False

-ProductCode

The product code of the application to retrieve information for.

Type: Guid[]
Parameter Sets: Search
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ApplicationType

Specifies the type of application to remove. Valid values are All, MSI, and EXE. The default value is All.

Type: String
Parameter Sets: Search
Aliases:

Required: False
Position: Named
Default value: All
Accept pipeline input: False
Accept wildcard characters: False

-IncludeUpdatesAndHotfixes

Include matches against updates and hotfixes in results.

Type: SwitchParameter
Parameter Sets: Search
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-FilterScript

A script used to filter the results as they're processed.

Type: ScriptBlock
Parameter Sets: Search
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ForceUninstallString

Forcibly uses the UninstallString instead of QuietUninstallString.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ArgumentList

Overrides the default MSI arguments specified in the config.psd1 file, or the arguments found in QuietUninstallString/UninstallString for EXE applications.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AdditionalArgumentList

Adds to the default MSI arguments specified in the config.psd1 file, or the arguments found in QuietUninstallString/UninstallString for EXE applications.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-SecureArgumentList

Hides all arguments passed to the executable from the Toolkit log file.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-LoggingOptions

Overrides the default MSI logging options specified in the config.psd1 file. Default options are: "/L*v".

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LogFileName

Overrides the default log file name. The default log file name is generated from the MSI file name. If the value of -LogFileName does not end in a common log file extension (.log, .logx, .txt, or .out), '.log' will be automatically appended.

For uninstallations, by default the product code is resolved to the DisplayName and version of the application.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WaitForChildProcesses

Specifies whether the started process should be considered finished only when any child processes it spawns have finished also.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-KillChildProcessesWithParent

Specifies whether any child processes started by the provided executable should be closed when the provided executable closes. This is handy for application installs that open web browsers and other programs that cannot be suppressed.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-SuccessExitCodes

List of exit codes to be considered successful. Defaults to values set during ADTSession initialization, otherwise: 0

Type: Int32[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RebootExitCodes

List of exit codes to indicate a reboot is required. Defaults to values set during ADTSession initialization, otherwise: 1641, 3010

Type: Int32[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IgnoreExitCodes

List the exit codes to ignore or * to ignore all exit codes. Where possible, please use -SuccessExitCodes and/or -RebootExitCodes instead, or -ErrorAction SilentlyContinue as this parameter is deprecated and will be removed in PSAppDeployToolkit 4.3.0.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: True

-ExitOnProcessFailure

Automatically closes the active deployment session via Close-ADTSession in the event the process exits with a non-success or non-ignored exit code.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns an object with ExitCode, StdOut, and StdErr output from the process. Note that a failed execution will only return an object if either -ErrorAction is set to SilentlyContinue/Ignore, or if -SuccessExitCodes is used.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Force

Allows the retrieval and/or removal of uninstall entries flagged as NoRemove or SystemComponent.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
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

PSADT.AppManagement.InstalledApplication

This function can receive one or more InstalledApplication objects for uninstallation.

OUTPUTS

None

By default, this function returns no output.

PSADT.ProcessManagement.ProcessResult

Returns an object with the results of the installation if -PassThru is specified.

- Process

- LaunchInfo

- CommandLine

- ExitCode

- StdOut

- StdErr

- Interleaved

NOTES

An active ADT session is NOT required to use this function.

More reading on how to create filterscripts https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/where-object?view=powershell-5.1#description

This function supports the -WhatIf and -Confirm parameters for testing changes before applying them.

Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2026 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0

https://psappdeploytoolkit.com/docs/reference/functions/Uninstall-ADTApplication

https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/blob/main/src/PSAppDeployToolkit/Public/Uninstall-ADTApplication.ps1