Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lachlann562 opened this issue Jul 2, 2021 · 0 comments
Open

Comments

@lachlann562
Copy link

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
   }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants