Applications which are running during package update time getting uninstalled.

Ravulacheruvu Deepthi (LTIMINDTREE LIMITED) 0 Reputation points Microsoft External Staff
2025-11-12T13:54:25.23+00:00

We have a DSC automation patching script which uses winget module which runs in the background I found some logs for Azure storage explorer and VS code.

Azure storage explorer logs

2025-11-11 15:02:08.021 DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-11 15:02:09.032 DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-11 15:02:10.038 DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-11 15:02:11.051 DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-11 15:02:12.060 Defaulting to Abort for suppressed message box (Abort/Retry/Ignore): C:\Program Files\Microsoft Azure Storage Explorer\d3dcompiler_47.dll

                      An error occurred while trying to replace the existing file:
                      DeleteFile failed; code 5.
                      Access is denied.

2025-11-11 15:02:12.060 User canceled the installation process. 2025-11-11 15:02:12.060 Rolling back changes. 2025-11-11 15:02:12.060 Starting the uninstallation process. 2025-11-11 15:02:12.060 Deleting file: C:\Program Files\Microsoft Azure Storage Explorer\chrome_200_percent.pak 2025-11-11 15:02:12.060 Deleting file: C:\Program Files\Microsoft Azure Storage Explorer\chrome_100_percent.pak 2025-11-11 15:02:12.060 Deleting directory: C:\Program Files\Microsoft Azure Storage Explorer\resources\app\node_modules\win-verify-signature\node_modules 2025-11-11 15:02:12.060 Deleting directory: C:\Program Files\Microsoft Azure Storage Explorer\resources\app\node_modules\win-verify-signature\lib 2025-11-11 15:02:12.060 Deleting directory: C:\Program Files\Microsoft Azure Storage Explorer\resources\app\node_modules\win-verify-signature 2025-11-11 15:02:12.060 Uninstallation process succeeded. 2025-11-11 15:02:12.060 Deinitializing Setup. 2025-11-11 15:02:12.060 Log closed.

**VS code logs:

**2025-11-05 15:56:48.246   Dest filename: C:\Program Files\Microsoft VS Code\Code.exe 2025-11-05 15:56:48.246   Time stamp of our file: 2025-10-14 23:10:48.000 2025-11-05 15:56:48.246   Dest file exists. 2025-11-05 15:56:48.246   Time stamp of existing file: 2025-10-08 14:28:38.000 2025-11-05 15:56:48.246   Installing the file. 2025-11-05 15:56:54.873   DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-05 15:56:55.876   DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-05 15:56:56.888   DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-05 15:56:57.900   DeleteFile: The existing file appears to be in use (5). Retrying. 2025-11-05 15:56:58.941   Defaulting to Abort for suppressed message box (Abort/Retry/Ignore):                          C:\Program Files\Microsoft VS Code\Code.exe                          An error occurred while trying to replace the existing file:                          DeleteFile failed; code 5.                          Access is denied. 2025-11-05 15:56:58.941   User canceled the installation process. 2025-11-05 15:56:58.941   Rolling back changes. 2025-11-05 15:56:58.943   Starting the uninstallation process. 2025-11-05 15:56:58.945   Uninstallation process succeeded. 2025-11-05 15:56:58.945   Deinitializing Setup. 2025-11-05 15:56:58.951   Log closed.

Windows for home | Windows 11 | Apps
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-11-12T13:54:39.3+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The issue you're experiencing with applications like Azure Storage Explorer and Visual Studio Code being uninstalled during package updates is likely due to the applications being in use at the time of the update. The logs indicate that the installer is unable to replace files because they are currently in use, which results in the installation process being aborted and the uninstallation being initiated instead.

    To prevent this from happening, consider the following best practices:

    1. Ensure Applications are Closed: Before running the update script, ensure that all instances of Azure Storage Explorer and Visual Studio Code are closed. This can help avoid file access conflicts during the update process.
    2. Use Task Scheduler: You can schedule the update script to run at a time when users are less likely to be using these applications.
    3. Check for Running Processes: Implement a check in your script to see if the applications are running before attempting to update them. If they are, you can either prompt the user to close them or automatically close them if appropriate.
    4. Error Handling: Enhance your script's error handling to manage situations where files are in use, allowing for retries or graceful exits instead of forcing uninstallation.

    By following these recommendations, you should be able to minimize the chances of applications being uninstalled during updates due to file access issues.

    0 comments No comments

  2. Aron 7,010 Reputation points Independent Advisor
    2025-11-12T14:48:49.2333333+00:00

    Hi,

    I checked what’s going on and it looks like the updates are failing because the apps are still open when the patch runs.

    When the installer can’t replace files that are in use, it aborts, and since the script suppresses prompts, that abort triggers a rollback, which ends up uninstalling the app.

    The easiest way to avoid this is to make sure those apps are closed before the update starts.

    You can add a quick check in your script to see if VS Code or Storage Explorer is running and stop them automatically or schedule the update for a time when no one’s using them.

    Would you like me to help you with a PowerShell snippet that does the process check and stops the apps, or build a full DSC workflow that handles this from start to finish?

    Regards,
    Aron

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.