示例#1
0
        private void UpdateHost_Click(object sender, EventArgs e)
        {
            ProcessStartInfo psi = new ProcessStartInfo();

            psi.FileName               = @"WMIC.exe";
            psi.UseShellExecute        = false;
            psi.RedirectStandardOutput = true;
            psi.Arguments              = @"ComputerSystem where Name='" + HardwareLibrary.ComputerName() + @"' call Rename Name='" + hostname.Text + "'";
            Process proc = Process.Start(psi);

            MessageBox.Show(proc.StandardOutput.ReadToEnd());
        }
示例#2
0
        public FormDSTools()
        {
            InitializeComponent();

            // get the assembly information to display current version in the title of the window
            var assemblyName = AssemblyName.GetAssemblyName(Assembly.GetExecutingAssembly().Location);

            // format window title text (append version to the current title)
            Text = $@"{Text} v{assemblyName.Version.Major}.{assemblyName.Version.Minor}";

            // get the current Windows Product Key and display it
            oldSerial.Text = KeyFinder.GetWindowsProductKeyFromRegistry();

            make.Text          = HardwareLibrary.ComputerMake();
            model.Text         = HardwareLibrary.ComputerModel();
            hostname.Text      = HardwareLibrary.ComputerName();
            machineSerial.Text = HardwareLibrary.SerialNumber();

            UpdateOnedriveInfo();
        }