How to remove installation folder completly on msiexec.exe

Deepak Joy Joseph 1 Reputation point

Hi All,
I am using this script to uninstall my product.

try { WshShell.Run("msiexec.exe /quiet /x {ProductCode}", 1, true); } catch(e) { }

The product is getting uninstalled but the root folder is not getting removed and it contains some file ( logs and all)

Is there any way to forcefully remove the entire folder even if it contains any folders or files.

Thanks in advance...!!!

Microsoft Technologies based on the .NET software framework.
3,596 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,567 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,600 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cheong00 3,476 Reputation points

    You just "take ownership" of such folders and delete them afterwards.

    By default, Windows Installers will not remove non-empty folders, and it has no knowledge on folders that didn't be created by it, so you need to do that manually.

    If your MSI file is created with WiX Toolset, you can add RemoveFile / RemoveFolder / RemoveFolderEx element to tell Windows Installer to remove those files on uninstall.

    For other MSI file creation products, you'll need to read their manual to see if they offer similar options.