Obtaining remote computer information in Visual C # using WMI

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.