Wednesday, May 2, 2012

Windows management Instrumentation


WMI is a set of extensions to the windows drives model that provides an opertaing system interface through which instrumental components provide information and notification.Microsoft also provides a command line interface to WMI called Windows Management Instrumentation Command Line(WMIC)
Win32-Operating System
            CSName,Caption,Windows directory,serialno,registered user,no of processes
Win32-Bios
Version,name,manufacturer,serialnumber,release date,current language,primary bios,status
            Win32-ComputerSystem
                        Manufacturer,username,totalphysicalmemory,system type,model
            Win32-Processor
                        Caption,Current Clock Speed
            Win32-TimeZone
                        Caption
            Win32-CDROMDrive
                        Caption,mediatype,drive,manufacturer,description
            Win32-Account
                        Name,description,domain,sid
            Win32-DiskDrive
                        Caption,deviceid,index,partitions


            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;

namespace WindowsFormsApplication1
{
    public partial class WMI : Form
    {
        public WMI()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            SelectQuery query = new SelectQuery("Win32OperatingSystem");
            ManagementObjectSearcher search = new ManagementObjectSearcher(query);
            foreach (ManagementObject mobj in search.Get())
            {
                MessageBox.Show(mobj["CSname"].ToString());
            }

        }

        private void WMI_Load(object sender, EventArgs e)
        {

        }
    }
}

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...