If you do not use WMI, the most common way to get system data from a remote computer is to run a client program on a remote computer that is used by the local machine to obtain system data from the remote computer. This implementation is difficult both in programming and in the subsequent distribution of programs. And using WMI, everything seems very simple. The following is an example of the function of using WMI to get data for a remote computer's hard disk. You can get other data on the remote computer by simply modifying the program. The following are the specific implementation steps:
1. Start visual Studio. Net, select the file, new, Project menu, and then set the project type to Visual C # project in the New Project dialog box, set the template to Windows application, and in the name Enter the "Get remote computer hard drive Information" in the text box and type "E:\VS" in the "Location" text box. NET project, and then click the OK button. So in "E:\VS." NET project directory, you create a new folder, "Get remote computer hard drive information," which contains the project file "Get remote computer hard drive information."
2. Because of visual Studio. NET default compilation environment does not include the file "System.Management.dll" in which the namespace "System.Management" is located, so first introduce this DLL file into the project file. The specific steps are as follows:
Select References in Solution Explorer, right-click, and in the pop-up menu, select Add Reference, as shown in Figure 05:
Figure 05: Adding a reference
In the Add Reference dialog box, select the. Net page, select System.managemen in the Component Name field, click the Select button, add "System.managemen" in the Selected Components column, and then click the OK button. , then in Visual Studio. NET integrated development environment, the namespace "System.managemen" is introduced. As shown in Figure 06:
Figure 06: Adding a reference