question

DeepakJoyJoseph-5501 avatar image
0 Votes"
DeepakJoyJoseph-5501 asked ·

How to remove installation folder completly on msiexec.exe


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...!!!

dotnet-csharpwindows-serverdotnet-ad-installer
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

cheong00 avatar image
0 Votes"
cheong00 answered ·

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.


· 8 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @cheong00 ,

Thanks for the replay!

I am using the .vdproj project using visual studio for creating MSI.

The root folder is created at the time of installation, so I want this folder to be removed even if it has Folders and Files.

Is there any way or anything I missed?

Thanks!

0 Votes 0 ·
cheong00 avatar image cheong00 DeepakJoyJoseph-5501 ·

Check the answer here.

You add a new "Class Library" project to your solution to host the custom action before step 3. Then step 3 to 8 is to link that code to "Custom Action" of installer project.


0 Votes 0 ·

Hi @cheong00 ,

Thanks for this replay.

Is it possible to do the same by modifying this

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


Is there any command that make msiexec.exe to remove the Application Installed folder forcefully?

Thanks!

0 Votes 0 ·
Show more comments