As shown in the picture I've retrieved the uninstallstring of an application.
And this is the code which I'm trying to make that application uninstall.
uninstlString = Convert.ToString(subkey.GetValue("UninstallString"));
if (uninstlString.Contains("MsiExec.exe"))
{
//Console.WriteLine(uninstlString);
//Console.ReadLine();
string args = "/x{" + uninstlString.Split("/".ToCharArray())[1].Split("I{".ToCharArray())[2];
//string prdctId = uninstlString.Substring(12);
uninstallProcess.StartInfo.FileName = uninstlString.Split("/".ToCharArray())[0];
uninstallProcess.StartInfo.Arguments = args;
uninstallProcess.StartInfo.UseShellExecute = false;
uninstallProcess.Start();
uninstallProcess.WaitForExit();
}
But after running this code...it says it the index is out of range... Can someone help me with the code?