Skip to main content

Remove-MSIApplications

SYNOPSISโ€‹

Removes all MSI applications matching the specified application name.

SYNTAXโ€‹

Remove-MSIApplications [-Name] <String> [-Exact] [-WildCard] [[-Parameters] <String>]
[[-AddParameters] <String>] [[-FilterApplication] <Array>] [[-ExcludeFromUninstall] <Array>]
[-IncludeUpdatesAndHotfixes] [[-LoggingOptions] <String>] [[-private:LogName] <String>] [-PassThru]
[[-ContinueOnError] <Boolean>] [<CommonParameters>]

DESCRIPTIONโ€‹

Removes all MSI applications matching the specified application name. Enumerates the registry for installed applications matching the specified application name and uninstalls that application using the product code, provided the uninstall string matches "msiexec".

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Remove-MSIApplications -Name 'Adobe Flash'

Removes all versions of software that match the name "Adobe Flash"

EXAMPLE 2โ€‹

Remove-MSIApplications -Name 'Adobe'

Removes all versions of software that match the name "Adobe"

EXAMPLE 3โ€‹

Remove-MSIApplications -Name 'Java 8 Update' -FilterApplication @(

@('Is64BitApplication', $false, 'Exact'), @('Publisher', 'Oracle Corporation', 'Exact') )

Removes all versions of software that match the name "Java 8 Update" where the software is 32-bits and the publisher is "Oracle Corporation".

EXAMPLE 4โ€‹

Remove-MSIApplications -Name 'Java 8 Update' -FilterApplication @(, @('Publisher', 'Oracle Corporation', 'Exact')) -ExcludeFromUninstall @(, @('DisplayName', 'Java 8 Update 45', 'Contains'))

Removes all versions of software that match the name "Java 8 Update" and also have "Oracle Corporation" as the Publisher; however, it does not uninstall "Java 8 Update 45" of the software. NOTE: If only specifying a single row in the two-dimensional arrays, the array must have the extra parentheses and leading comma as in this example.

EXAMPLE 5โ€‹

Remove-MSIApplications -Name 'Java 8 Update' -ExcludeFromUninstall @(, @('DisplayName', 'Java 8 Update 45', 'Contains'))

Removes all versions of software that match the name "Java 8 Update"; however, it does not uninstall "Java 8 Update 45" of the software. NOTE: If only specifying a single row in the two-dimensional array, the array must have the extra parentheses and leading comma as in this example.

EXAMPLE 6โ€‹

Remove-MSIApplications -Name 'Java 8 Update' -ExcludeFromUninstall @(

@('Is64BitApplication', $true, 'Exact'), @('DisplayName', 'Java 8 Update 45', 'Exact'), @('DisplayName', 'Java 8 Update 4*', 'WildCard'), @('DisplayName', 'Java \d Update \d{3}', 'RegEx'), @('DisplayName', 'Java 8 Update', 'Contains'))

Removes all versions of software that match the name "Java 8 Update"; however, it does not uninstall 64-bit versions of the software, Update 45 of the software, or any Update that starts with 4.

PARAMETERSโ€‹

-Nameโ€‹

The name of the application to uninstall. Performs a contains match on the application display name by default.

Type: String
Parameter Sets: (All)
Aliases:

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

-Exactโ€‹

Specifies that the named application must be matched using the exact name.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-WildCardโ€‹

Specifies that the named application must be matched using a wildcard search.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Parametersโ€‹

Overrides the default parameters specified in the XML configuration file. Uninstall default is: "REBOOT=ReallySuppress /QN".

Type: String
Parameter Sets: (All)
Aliases: Arguments

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

-AddParametersโ€‹

Adds to the default parameters specified in the XML configuration file. Uninstall default is: "REBOOT=ReallySuppress /QN".

Type: String
Parameter Sets: (All)
Aliases:

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

-FilterApplicationโ€‹

Two-dimensional array that contains one or more (property, value, match-type) sets that should be used to filter the list of results returned by Get-InstalledApplication to only those that should be uninstalled. Properties that can be filtered upon: ProductCode, DisplayName, DisplayVersion, UninstallString, InstallSource, InstallLocation, InstallDate, Publisher, Is64BitApplication

Type: Array
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: @(@())
Accept pipeline input: False
Accept wildcard characters: False

-ExcludeFromUninstallโ€‹

Two-dimensional array that contains one or more (property, value, match-type) sets that should be excluded from uninstall if found. Properties that can be excluded: ProductCode, DisplayName, DisplayVersion, UninstallString, InstallSource, InstallLocation, InstallDate, Publisher, Is64BitApplication

Type: Array
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: @(@())
Accept pipeline input: False
Accept wildcard characters: False

-IncludeUpdatesAndHotfixesโ€‹

Include matches against updates and hotfixes in results.

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 logging options specified in the XML configuration file. Default options are: "/L*v".

Type: String
Parameter Sets: (All)
Aliases:

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

-private:LogNameโ€‹

{{ Fill private:LogName Description }}

Type: String
Parameter Sets: (All)
Aliases: LogName

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

-PassThruโ€‹

Returns ExitCode, STDOut, and STDErr output from the process.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ContinueOnErrorโ€‹

Continue if an error occured while trying to start the processes. Default: $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 8
Default value: True
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โ€‹

PSObjectโ€‹

Returns an object with the following properties:โ€‹

- ExitCodeโ€‹

- StdOutโ€‹

- StdErrโ€‹

NOTESโ€‹

More reading on how to create arrays if having trouble with -FilterApplication or -ExcludeFromUninstall parameter: http://blogs.msdn.com/b/powershell/archive/2007/01/23/array-literals-in-powershell.aspx

https://psappdeploytoolkit.com