Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Uninstallation of msi file programatically

Uninstallation of msi file programatically

Scheduled Pinned Locked Moved C#
debugging
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NarVish
    wrote on last edited by
    #1

    I could able to install msi file using below code and it installed sucessfully

    string path = @"C:\Projects\Debug\ELSWinServInstaller.msi";
    Process process = Process.Start(path);
    process.WaitForInputIdle();
    process.WaitForExit();

    I tried to uninstall the same using below code, but its not working.

    Process p = new Process();
    p.StartInfo.FileName = "msiexec.exe";
    p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";
    p.Start();

    Please let me know where I went wrong.

    L A S Richard DeemingR 4 Replies Last reply
    0
    • N NarVish

      I could able to install msi file using below code and it installed sucessfully

      string path = @"C:\Projects\Debug\ELSWinServInstaller.msi";
      Process process = Process.Start(path);
      process.WaitForInputIdle();
      process.WaitForExit();

      I tried to uninstall the same using below code, but its not working.

      Process p = new Process();
      p.StartInfo.FileName = "msiexec.exe";
      p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";
      p.Start();

      Please let me know where I went wrong.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      NarVish wrote:

      Please let me know where I went wrong.

      You forgot to explain what "is not working" means. Did it start the process? Did it throw an exception?

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] They hate us for our freedom![^]

      N 1 Reply Last reply
      0
      • L Lost User

        NarVish wrote:

        Please let me know where I went wrong.

        You forgot to explain what "is not working" means. Did it start the process? Did it throw an exception?

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] They hate us for our freedom![^]

        N Offline
        N Offline
        NarVish
        wrote on last edited by
        #3

        "I tried to uninstall the same using below code, but its not working." Process p = new Process(); p.StartInfo.FileName = "msiexec.exe"; p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn"; p.Start(); Unistallation code is not working. It didn't throw any exception. it executed each line. but uninstallation didn't happen.

        L 1 Reply Last reply
        0
        • N NarVish

          I could able to install msi file using below code and it installed sucessfully

          string path = @"C:\Projects\Debug\ELSWinServInstaller.msi";
          Process process = Process.Start(path);
          process.WaitForInputIdle();
          process.WaitForExit();

          I tried to uninstall the same using below code, but its not working.

          Process p = new Process();
          p.StartInfo.FileName = "msiexec.exe";
          p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";
          p.Start();

          Please let me know where I went wrong.

          A Offline
          A Offline
          Abhinav S
          wrote on last edited by
          #4

          Could be a permission issue. For Vista and Windows 7, you might need to run this program as an administrator to uninstall the program.

          WP Apps - Color Search | Arctic | XKCD | Sound Meter | Speed Dial

          N 1 Reply Last reply
          0
          • A Abhinav S

            Could be a permission issue. For Vista and Windows 7, you might need to run this program as an administrator to uninstall the program.

            WP Apps - Color Search | Arctic | XKCD | Sound Meter | Speed Dial

            N Offline
            N Offline
            NarVish
            wrote on last edited by
            #5

            I have administrator rights. If it is permission issue, my installation code also should not work. But installation done sucessfully.

            1 Reply Last reply
            0
            • N NarVish

              I could able to install msi file using below code and it installed sucessfully

              string path = @"C:\Projects\Debug\ELSWinServInstaller.msi";
              Process process = Process.Start(path);
              process.WaitForInputIdle();
              process.WaitForExit();

              I tried to uninstall the same using below code, but its not working.

              Process p = new Process();
              p.StartInfo.FileName = "msiexec.exe";
              p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";
              p.Start();

              Please let me know where I went wrong.

              S Offline
              S Offline
              Simon_Whale
              wrote on last edited by
              #6

              can you uninstall this application from a command prompt? by running the same command? i.e.

              c:\Projects\Debug\ELSWinServInstaller.msi /qn

              Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

              N 1 Reply Last reply
              0
              • S Simon_Whale

                can you uninstall this application from a command prompt? by running the same command? i.e.

                c:\Projects\Debug\ELSWinServInstaller.msi /qn

                Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

                N Offline
                N Offline
                NarVish
                wrote on last edited by
                #7

                yes, its working fine when I run the below command in visual studio command prompt. c:\Program Files\Microsoft Visual Studio 10.0\VC>msiexec /x C:\Lalitha\Projects\ Debug\ELSWinServInstaller.msi

                1 Reply Last reply
                0
                • N NarVish

                  I could able to install msi file using below code and it installed sucessfully

                  string path = @"C:\Projects\Debug\ELSWinServInstaller.msi";
                  Process process = Process.Start(path);
                  process.WaitForInputIdle();
                  process.WaitForExit();

                  I tried to uninstall the same using below code, but its not working.

                  Process p = new Process();
                  p.StartInfo.FileName = "msiexec.exe";
                  p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";
                  p.Start();

                  Please let me know where I went wrong.

                  Richard DeemingR Offline
                  Richard DeemingR Offline
                  Richard Deeming
                  wrote on last edited by
                  #8

                  NarVish wrote:

                  p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";;

                  Do you need a space between the closing quote around the MSI path and the /qn argument?

                  p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\" /qn";


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                  N 1 Reply Last reply
                  0
                  • Richard DeemingR Richard Deeming

                    NarVish wrote:

                    p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn";;

                    Do you need a space between the closing quote around the MSI path and the /qn argument?

                    p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\" /qn";


                    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                    N Offline
                    N Offline
                    NarVish
                    wrote on last edited by
                    #9

                    I tried by giving space as per your suggestion. Still, problem exists. No change

                    1 Reply Last reply
                    0
                    • N NarVish

                      "I tried to uninstall the same using below code, but its not working." Process p = new Process(); p.StartInfo.FileName = "msiexec.exe"; p.StartInfo.Arguments = "/x \"C:\\Projects\\Debug\\ELSWinServInstaller.msi\"/qn"; p.Start(); Unistallation code is not working. It didn't throw any exception. it executed each line. but uninstallation didn't happen.

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      NarVish wrote:

                      Unistallation code is not working. It didn't throw any exception. it executed each line. but uninstallation didn't happen.

                      That's a better description; now we can rule out any exceptions and focus on the rest. From where are you starting this? From a Windows-service? You could check the eventlog for any errors. As a quick workaround, try putting the complete command in a batch-file and execute that from code.

                      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] They hate us for our freedom![^]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups