I'm trying to get the activation status of Windows. I've got this code:
Process proc = new Process();
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.StartInfo.FileName = "cmd.exe";
proc.StartInfo.Arguments = "/C slmgr /xpr";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardInput = true;
proc.Start();
string x = "";
while (!proc.HasExited)
{
x += proc.StandardOutput.ReadToEnd();
}
return x;
As some of you may know, the command "slmgr /xpr" will make a pop-up appear informing you of your Windows activation status.
Executing this code, I get the pop-up box (and "x" is empty). What I want is to get the text that's in it (so it appears on a label in my form). I wonder if there's any way to extract just the text from inside the pop-up that appears, in this case it would be something like "the machine is permanently activated".
Is there any simple way to achieve this?