uninstallOldGanache = async (pattern) => {
    const isInstalled = await new Promise((resolve, reject) => {
      exec(`powershell.exe Get-AppxPackage ${pattern}`, (error, stdout) => {
        if (error) {
          return reject(error);
        }

        // The output should be an empty string if no package matches, but to
        // guard against changes, let's just check that the `Name` label exists.
        const isMatch = stdout.indexOf("Name") != -1;

        resolve(isMatch);
      });
    });

    if (isInstalled) {
      await new Promise((resolve, reject) => { 
        const proc = exec(`powershell.exe Start-Process -Verb runAs powershell -argumentList '\\"Get-AppxPackage ${pattern} | Remove-AppxPackage\\"'`);

        proc.on('close', (code) => {
          if (code === 0) {
            resolve();
          } else {
            reject(new Error(`Attempting to uninstall old versions failed.\nExited with code ${code}`));
          }
        })
        .on("error", (err) => reject(err));
      });
    }
  }
When we switched from Consensys code signing certificates to Truffle code
signing certificates (v.2.3.0) we had to change the name of our AppX
application so that Windows would let it install without conflict. This
function will move the old version's workspaces and global settings file
over to the new workspace folder.