Данная статья описывает создание программы запуска «инсталляционных» файлов и отслеживание завершения, как основного, так и дочерних процессов создаваемых основным. Создайте приложение Continue Reading
Рубрика: WMI
public void deleteService() { try { #region Code to stop the service string serviceName = "r_server"; ConnectionOptions co = new ConnectionOptions(); co.Username = textEdit2.Text; co.Password = textEdit3.Text; Continue Reading
/// name of the printer we want to remove/// public bool RemovePrinter(string name) { try { //use the ManagementScope class to connect to the local machine ManagementScope Continue Reading
Способ 1: RegistryKey rk = Registry.LocalMachine; RegistryKey rk1 = rk.OpenSubKey(@"SOFTWAREMicrosoftWindows NTCurrentVersionSystemRestore"); string sysRestore = rk1.GetValue("RPSessionInterval").ToString(); if (sysRestore.Contains("1")) { MessageBox.Show("System Restore is Enabled"); } if (sysRestore.Contains("0")) { MessageBox.Show("System Continue Reading
Рассмотрим пример получения информации о подключенных USB накопителях с использованием WMI (Windows Management Instrumentation) и его класса Win32_DiskDrive. Класс Win32_DiskDrive позволяет получить информацию о Continue Reading
public List GetInstalledPrinters() { List printerList = new List(); try { //set the scope of this search to the local machine ManagementScope scope = new ManagementScope(ManagementPath.DefaultPath); //connect Continue Reading
Данный пример показывает реализацию получения локальной и удаленной SMART информации с установленных жестких дисков на компьютере, с использованием WMI классов: Win32_DiskDrive; Win32_PhysicalMedia; MSStorageDriver_FailurePredictStatus; MSStorageDriver_FailurePredictThresholds; Continue Reading
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using System.Management; using DevExpress.XtraBars.Alerter; namespace usbport { public partial class Form1 : DevExpress.XtraEditors.XtraForm { public Form1() { InitializeComponent(); } Continue Reading
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Management; using System.DirectoryServices; using System.Net; using System.Collections; using System.ServiceProcess; using Continue Reading
class printport { string DeviceID; string DriverName; string PortName; Boolean Shared; string ShareName; private ManagementScope managementScope = null; private ManagementClass InitClass(string className) { //specify Printer class management Continue Reading
/// /// method to set a specified printer as the system's default printer /// /// name of the printer we want to be default/// Returns true if Continue Reading
public int state() { ConnectionOptions co = new ConnectionOptions(); co.Username = textEdit1.Text; co.Password = textEdit2.Text; co.EnablePrivileges = true; co.Impersonation = ImpersonationLevel.Impersonate; ManagementScope scope = new ManagementScope(string.Format(@"\{0}rootCIMV2", textEdit3.Text)); Continue Reading
Название: Администрирование Windows с помощью WMI и WMIC (+ CD-ROM) Автор: Попов Андрей, Шикин Евгений Издательство: БХВ-Петербург Год: 2004 Формат: DjVu ISBN: 5-94157-349-9 Язык: Русский Размер: 15.4 Continue Reading
public static bool DeletePrinter(string sPrinterName) { ManagementScope oManagementScope = new ManagementScope(ManagementPath.DefaultPath); oManagementScope.Connect(); SelectQuery oSelectQuery = new SelectQuery(); oSelectQuery.QueryString = @"SELECT * FROM Win32_Printer WHERE Name = '" Continue Reading
В случае если необходимо установить драйвер к USB накопителю или выполнить программный ремонт, вам не обойтись без получения двух идентификаторов устройства: VID – это Continue Reading
Windows Management Instrumentation (WMI) в дословном переводе — это инструментарий управления Windows. Если говорить более развернуто, то WMI — это одна из базовых технологий для централизованного управления Continue Reading
public int stopService() { int ret; #region Code to Stop the service ConnectionOptions co = new ConnectionOptions(); co.Username = textEdit1.Text; //Логин для подключения co.Password = textEdit2.Text; //Пароль Continue Reading
public void AddPrinterPort() { ConnectionOptions connectionOptions; ManagementPath managementPath; ManagementScope managementScope; ManagementObject port; PutOptions putOptions; try { connectionOptions = new ConnectionOptions(); connectionOptions.EnablePrivileges = true; connectionOptions.Impersonation = System.Management.ImpersonationLevel.Impersonate; managementPath Continue Reading
Описываем класс опций адаптера: public class AdapterOptions { string _adapterName; // Имя адаптера public string AdapterName { get { return _adapterName; } set { _adapterName = value; Continue Reading
Чтобы определить тип (модель), количество ядер, загрузку процессора и многое другое, можно воспользоваться классом инструментария управления Windows (WMI(http://ru.wikipedia.org/wiki/WMI)) Win32_Processor в пространстве имен rootcimv2. Сам Continue Reading