Skip to content

Support asynchronous install of MSI to allow cancelling of install. #44

@lachlann562

Description

@lachlann562

It would be nice if the Install-MSI function could support a 3-part asynch model. The reason is, if i "stop" a powershell script execution while it is running an MSI, the MSI runs to completion (taking several minutes) and i would like it to cancel/rollback the MSI, it also gives me more control of when to start the MSI progress bar and potentially nest it under other progress bars.

Example cmdlets:

  1. Start-MSIInstall
    Starts the installer and returns a context object
  2. Watch-MSIInstall
    Monitors the installer using the context object and displays progress bars, etc
  3. Stop-MSIInstall
    Stops/cancels the install

Example desired code:

try {
   $MSIObject = Start-MSIInstall $InstallPath
   $MSIObject | Watch-MSIInstall -ParentProgressID $MyProgressID
} catch {
   #do some thing
} finally {
   #ensure MSI is not still running 
   if ($MSIObject.IsRunning) {
       $MSIObject | Stop-MSIInstall
   }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions