title: How to uninstall with msiexec using product id guid without .msi file present
body: <p>I'm trying to automate the uninstallation of packages created using WiX for the purposes of changing the installed software stack &amp; configuration without reprovisioning a whole OS. Eventually I'll use powershell scripting to do this but at the moment I can't seem to get my test package to uninstall interactively with cmd.</p>
  
  <p>If I run:</p>
  
  <p><code>msiexec /x '{A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8}'</code></p>
  
  <p><code>msiexec /x A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8</code></p>
  
  <p>I get:</p>
  
  <p><em>"The installation package could not be opened. Verify that the package
  exists and that you can access it, or contact the application vendor
  to verify that this is a valid Windows Installer Package."</em></p>
  
  <p>If I run:
  <code>msiexec /x {A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8}</code></p>
  
  <p>I get:</p>
  
  <p><em>"This action is only valid for products that are currently installed"</em></p>
  
  <p>I've looked at the <a href="http://msdn.microsoft.com/en-us/library/aa372845%28v=vs.85%29.aspx" rel="noreferrer">windows installer guide</a>, the <a href="http://wixtoolset.org/documentation/manual/v3/" rel="noreferrer">WiX documentation</a>, msiexec documentation and used orca to go over the .msi myself but I've not really found anything that gives a clear picture of how an uninstall is processed. Is the .msi file required and if not then why does windows installer seem to think it is when given a GUID?</p>
  
  <p>The WiX code for the .msi installer is:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='windows-1252'?&gt;
  &lt;Wix xmlns='htp://schemas.microsoft.com/wix/2006/wi' &gt;
  
    &lt;!--DO NOT COPY / PASTE THE PRODUCT ID GUID BELOW TO YOUR OWN WIX SOURCE --&gt;
  
    &lt;Product Id='A4BFF20C-A21E-4720-88E5-79D5A5AEB2E8' Language='2057' 
             Manufacturer='COMPANYNAME IT-Operations' 
             Name='COMPANYNAMEServerListener' Version='1.0.0' 
             UpgradeCode='PUT-GUID-HERE'&gt;
  
     &lt;Package Id='*' Manufacturer='COMPANYNAME IT-Operations' Compressed='yes' /&gt;
     &lt;Media Id='1' Cabinet='COMPANYNAMEServerListener.cab' EmbedCab='yes' /&gt;
  
      &lt;Directory Id='TARGETDIR' Name='SourceDir'&gt;
        &lt;Directory Id='ProgramFilesFolder' Name='PFiles'&gt;
        &lt;Directory Id='COMPANYNAME' Name='COMPANYNAME'&gt;
          &lt;Directory Id='INSTALLDIR' Name='COMPANYNAMEServerListener'&gt;
          &lt;Component Id='MainExecutable' Guid='*' &gt;
            &lt;File Id='COMPANYNAMEServerListener.exe' 
                  Source='COMPANYNAMEServerListener.exe' Vital='yes' 
                  KeyPath='yes' /&gt;
            &lt;ServiceInstall 
              Id='COMPANYNAMEServerListenerInstall'
              DisplayName='COMPANYNAMEServerListener'
              Description='Accepts and discards TCP connections on port 28028 to indicate that this server is alive and ready to be controlled'
              Name='COMPANYNAMEServerListener'
              Account='NT AUTHORITY\LocalService'
              ErrorControl='normal'
              Start='auto'
              Type='ownProcess'
              Vital='yes'           
            &gt;
              &lt;ServiceDependency Id='tcpip'/&gt;
            &lt;/ServiceInstall&gt;
            &lt;ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="COMPANYNAMEServerListener" Wait="yes" /&gt;
          &lt;/Component&gt;
          &lt;/Directory&gt;
          &lt;/Directory&gt;
        &lt;/Directory&gt;
        &lt;/Directory&gt;
  
      &lt;Feature Id='Complete' Level='1' &gt;
        &lt;ComponentRef Id='MainExecutable' /&gt;
      &lt;/Feature&gt;
  
      &lt;CustomTable Id ="COMPANYNAMEMetadata"&gt;
        &lt;Column Id="Property" Type="string" Category="Identifier" PrimaryKey="yes"/&gt;
        &lt;Column Id="Value" Type="string"/&gt;
        &lt;Row&gt;
        &lt;Data Column="Property"&gt;InstallString&lt;/Data&gt;
        &lt;Data Column="Value"&gt;/qn&lt;/Data&gt;
        &lt;/Row&gt;
      &lt;/CustomTable&gt;
  
  
    &lt;/Product&gt;
  &lt;/Wix&gt;
  </code></pre>