using System; using System.Diagnostics; using System.Windows; namespace WarnWindows11 { public class OSWarning { public static void Main(string[] args) { try { var windows11 = false; using (var process = new Process()) { process.StartInfo.FileName = "systeminfo.exe"; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.Start(); // Synchronously read the standard output of the spawned process. var reader = process.StandardOutput; string output = reader.ReadToEnd(); var lines = output.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var line in lines) { if (line.ToUpper().Contains("MICROSOFT WINDOWS 11")) { windows11 = true; } } process.WaitForExit(); } if (windows11) { _ = MessageBox.Show(Properties.Resources.WARNING_WINDOWS11); } } catch (Exception) { } } } }