Пример #1
0
        private void UpdateOnedriveInfo()
        {
            onedriveButton.Enabled = false;
            //ModifyRegistry.ModifyRegistry userShellFolders = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, @"Microsoft", @"Windows\CurrentVersion\Explorer\User Shell Folders");
            ModifyRegistry.ModifyRegistry userShellFolders      = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, "Microsoft", @"Windows\CurrentVersion\Explorer\User Shell Folders");
            ModifyRegistry.ModifyRegistry onedriveFolder        = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, @"Microsoft", @"OneDrive\Accounts\Business1");
            ModifyRegistry.ModifyRegistry onedriveVersionFolder = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, @"Microsoft", @"Onedrive");


            string             user        = Environment.UserName;
            NTAccount          currentUser = new NTAccount(user);
            SecurityIdentifier sid         = (SecurityIdentifier)currentUser.Translate(typeof(SecurityIdentifier));

            SID.Text             = sid.ToString();
            desktopLocation.Text = userShellFolders.ReadString("{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}");
            documents.Text       = userShellFolders.ReadString("Personal");
            deviceID.Text        = HardwareLibrary.DeviceID();
            LoadAdminGroup();

            bool onedriveInstalled = (onedriveFolder.ReadString(@"UserFolder") == null) ? false : true;

            if (onedriveInstalled)
            {
                onedrive.Text = onedriveFolder.ReadString("UserFolder");
                version.Text  = onedriveVersionFolder.ReadString("Version");
                Thread.Sleep(200);
                onedriveButton.Enabled = true;
            }
        }
Пример #2
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());
        }
Пример #3
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();
        }