This article turns from: http://singlepine.cnblogs.com/articles/299457.html
1.WMI Introduction
WMI is a shorthand for English Windows Management instrumentation, which functions primarily by accessing information and services from local hosts, and managing remote computers (you must have sufficient privileges), such as restarting, shutting down, shutting down processes, creating processes, and so on.
2. Add System.Management.dll first when using, and then reference using System.Management;
Using System.Threading;
3. Sample Code
3.1 HTML code
< HTML >
< head >
< title > Wmitest </title >
< meta name = "Generator" Content = "Microsoft Visual Studio. NET 7.1" >
< meta name = "Code_language" Content = "C #" >
< meta name = "vs_defaultClientScript" content = "JavaScript" >
< meta name = "vs_targetschema" content = "http://schemas.microsoft.com/intellisense/ie5" >
< body ms_positioning = "GridLayout" >
< form ID = "Form1" method = "post" runat = "server" >
< FONT face = "Song Body" >
< Asp:button ID = "Button1" style = "z-index:101"; left:48px; Position:absolute; top:16px "runat =" server "
Text = "Get information for local Disk" Width = "152px" ></Asp:button >
< Asp:button ID = "Button2" style = "z-index:102"; left:32px; Position:absolute; top:56px "runat =" server "
Text = "Get capacity of specified disk" Width = "144px" ></Asp:button >
< Asp:button ID = "Button3" style = "z-index:103"; left:32px; Position:absolute; top:96px "runat =" server "
Text = "List all shared resources in the machine" Width = "192px" ></Asp:button >
< Asp:button ID = "Button4" style = "z-index:104"; left:8px; Position:absolute; top:128px "runat =" server "
Text = "control allows a folder in the system to be shared or unshared" Width = "264px" ></Asp:button >
< Asp:button ID = "BUTTON5" style = "z-index:105"; left:48px; Position:absolute; top:160px "runat =" server "
Text = "Get the running state of the system service" ></Asp:button >
< Asp:button ID = "BUTTON6" style = "z-index:106"; left:40px; Position:absolute; top:192px "runat =" server "
Text = "Modify IP via WMI without rebooting" Width = "248px" ></Asp:button >
< Asp:button ID = "Button7" style = "z-index:107"; left:24px; Position:absolute; top:224px "runat =" server "
Text = "How to use WMI to remotely reboot a remote computer" Width = "232px" ></Asp:button >
< Asp:button ID = "Button8" style = "z-index:108"; left:40px; Position:absolute; top:264px "runat =" server "
Text = "Create a new process with WMI" Width = "192px" ></Asp:button >
< Asp:button ID = "Button9" style = "z-index:109"; left:32px; Position:absolute; top:296px "runat =" server "
Text = "How to terminate a process through WMI" Width = "192px" ></Asp:button >
< Asp:button ID = "BUTTON10" style = "z-index:110"; left:32px; Position:absolute; top:328px "runat =" server "
Text = "How to use WMI to get the directory of a remote machine and the file" Width = "280px" ></Asp:button >
< Asp:button ID = "BUTTON11" style = "z-index:111"; left:424px; Position:absolute; top:24px "runat =" server "
Text = "MAC address of network card" Width = "120px" ></Asp:button >
< Asp:button ID = "BUTTON12" style = "z-index:112"; left:456px; Position:absolute; top:64px "runat =" server "
Text = "Serial number of CPU" Width = "104px" ></Asp:button >
< Asp:button ID = "BUTTON13" style = "z-index:113"; left:448px; Position:absolute; top:120px "
runat = "server" Text = "serial number of the motherboard" ></Asp:button >
< Asp:button ID = "BUTTON14" style = "z-index:114"; left:472px; Position:absolute; top:160px "
runat = "server" Text = "Get Hard drive ID" ></Asp:button >
< Asp:button ID = "BUTTON15" style = "z-index:115"; left:448px; Position:absolute; Top:208px "