Skip to main content

Execute-MSI

SYNOPSISโ€‹

Executes msiexec.exe to perform the following actions for MSI & MSP files and MSI product codes: install, uninstall, patch, repair, active setup.

SYNTAXโ€‹

Execute-MSI [[-Action] <String>] [-Path] <String> [[-Transform] <String>] [[-Parameters] <String>]
[[-AddParameters] <String>] [-SecureParameters] [[-Patch] <String>] [[-LoggingOptions] <String>]
[[-private:LogName] <String>] [[-WorkingDirectory] <String>] [-SkipMSIAlreadyInstalledCheck]
[-IncludeUpdatesAndHotfixes] [-NoWait] [-PassThru] [[-IgnoreExitCodes] <String>]
[[-PriorityClass] <ProcessPriorityClass>] [[-ExitOnProcessFailure] <Boolean>] [[-RepairFromSource] <Boolean>]
[[-ContinueOnError] <Boolean>] [<CommonParameters>]

DESCRIPTIONโ€‹

Executes msiexec.exe to perform the following actions for MSI & MSP files and MSI product codes: install, uninstall, patch, repair, active setup.

If the -Action parameter is set to "Install" and the MSI is already installed, the function will exit.

Sets default switches to be passed to msiexec based on the preferences in the XML configuration file.

Automatically generates a log file name and creates a verbose log file for all msiexec operations.

Expects the MSI or MSP file to be located in the "Files" sub directory of the App Deploy Toolkit. Expects transform files to be in the same directory as the MSI file.

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Execute-MSI -Action 'Install' -Path 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi'

Installs an MSI

EXAMPLE 2โ€‹

Execute-MSI -Action 'Install' -Path 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi' -Transform 'Adobe_FlashPlayer_11.2.202.233_x64_EN_01.mst' -Parameters '/QN'

Installs an MSI, applying a transform and overriding the default MSI toolkit parameters

EXAMPLE 3โ€‹

[PSObject]$ExecuteMSIResult = Execute-MSI -Action 'Install' -Path 'Adobe_FlashPlayer_11.2.202.233_x64_EN.msi' -PassThru

Installs an MSI and stores the result of the execution into a variable by using the -PassThru option

EXAMPLE 4โ€‹

Execute-MSI -Action 'Uninstall' -Path '{26923b43-4d38-484f-9b9e-de460746276c}'

Uninstalls an MSI using a product code

EXAMPLE 5โ€‹

Execute-MSI -Action 'Patch' -Path 'Adobe_Reader_11.0.3_EN.msp'

Installs an MSP

PARAMETERSโ€‹

-Actionโ€‹

The action to perform. Options: Install, Uninstall, Patch, Repair, ActiveSetup.

Type: String
Parameter Sets: (All)
Aliases:

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

-Pathโ€‹

The path to the MSI/MSP file or the product code of the installed MSI.

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

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

-Transformโ€‹

The name of the transform file(s) to be applied to the MSI. The transform file is expected to be in the same directory as the MSI file. Multiple transforms have to be separated by a semi-colon.

Type: String
Parameter Sets: (All)
Aliases:

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

-Parametersโ€‹

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

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

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

-AddParametersโ€‹

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

Type: String
Parameter Sets: (All)
Aliases:

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

-SecureParametersโ€‹

Hides all parameters passed to the MSI or MSP file 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

-Patchโ€‹

The name of the patch (msp) file(s) to be applied to the MSI for use with the "Install" action. The patch file is expected to be in the same directory as the MSI file. Multiple patches have to be separated by a semi-colon.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
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: 7
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: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WorkingDirectoryโ€‹

Overrides the working directory. The working directory is set to the location of the MSI file.

Type: String
Parameter Sets: (All)
Aliases:

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

-SkipMSIAlreadyInstalledCheckโ€‹

Skips the check to determine if the MSI is already installed on the system. Default is: $false.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-NoWaitโ€‹

Immediately continue after executing the process.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-IgnoreExitCodesโ€‹

List the exit codes to ignore or * to ignore all exit codes.

Type: String
Parameter Sets: (All)
Aliases:

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

-PriorityClassโ€‹

Specifies priority class for the process. Options: Idle, Normal, High, AboveNormal, BelowNormal, RealTime. Default: Normal

Type: ProcessPriorityClass
Parameter Sets: (All)
Aliases:
Accepted values: Normal, Idle, High, RealTime, BelowNormal, AboveNormal

Required: False
Position: 11
Default value: Normal
Accept pipeline input: False
Accept wildcard characters: False

-ExitOnProcessFailureโ€‹

Specifies whether the function should call Exit-Script when the process returns an exit code that is considered an error/failure. Default: $true

Type: Boolean
Parameter Sets: (All)
Aliases:

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

-RepairFromSourceโ€‹

Specifies whether we should repair from source. Also rewrites local cache. Default: $false

Type: Boolean
Parameter Sets: (All)
Aliases:

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

-ContinueOnErrorโ€‹

Continue if an error occurred while trying to start the process. Default: $false.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 14
Default value: False
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 a PSObject with the results of the installationโ€‹

- ExitCodeโ€‹

- STDOutโ€‹

- STDErrโ€‹

NOTESโ€‹

https://psappdeploytoolkit.com