In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the theoretical knowledge of C# remote computer, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
I. some theoretical knowledge of C # remote computer startup:
The principle of starting a C# remote computer is the Windows Management Specification. Is the so-called "WMI" (Windows Management Instrumentation). The Windows Management Specification (WMI) supports managing the structure of the system through Internet. By providing consistent observation of the management environment, WMI provides users with common access management information. The consistency of this management enables you to manage the entire system, not just the components. From Microsoft MSDN, you can get more information about the WMI Software Development Kit (SDK).
WMI (Windows Management Specification) supports a limited security format that allows users to authenticate each user before connecting to WMI on a local or remote computer. This security is another layer at the top of the existing security of the operating system. WMI does not override or break any existing security provided by the operating system. By default, all members of the administrators group have complete control over the WMI service on the computers it manages. All other users only have read / write / execute permissions on their local computers. You can change permissions by adding users to the administrators group on managed computers, or by authorizing users or groups in WMI and setting permission levels. Access is based on the WMI namespace. In general, the default namespace for scripts is "root\ cimv2".
There are many amazing features in WMI. Rebooting the remote computer is a small feature. Using WMI in a program, you can write many remote management types of applications. Because the .net FrameWork SDK provides namespaces that can manipulate WMI directly, C # can take advantage of the classes defined in these namespaces to take full advantage of the convenience of WMI control.
Two. environment settings for program design and operation:
1) windows 2000 Professional
2). Net FrameWork SDK
3) the administrator account of the remote computer
These are not only local computer configurations, but also remote computer configurations.
3. To restart the remote computer, it is used to manipulate WMI namespaces and classes in .net FrameWork SDK:
Add reference System.Management
The namespace used to manipulate WMI in .net FrameWork SDK is mainly "System.Management". There are six main classes used to restart a remote computer:
The ◆ "ConneCTionOptions" class mainly defines the administrator account of the remote computer.
◆ "ManagementScope" is a computer that connects to a given computer name or IP address with a given administrator account.
The ◆ "ObjectQuery" class function defines which remote operations are to be implemented on remote computers
The ◆ "ManagementObjectSearcher" class gets those WMI operations from a computer that has completed a remote connection
The ◆ "ManagementObjectCollection" class stores the WMI operation
The ◆ "ManagementObject" class calls the remote computer for WMI operations.
The operation introduced in this article is to start the C# remote computer.
IV. Important steps and implementation methods of starting a C# remote computer:
1. Connect to the remote computer:
You can connect to a remote computer by following the following statements:
ConnectionOptionsoptions=newConnectionOptions ()
Options.Username= "Manager account user name"
Options.Password= "Manager account password"
ManagementScopescope=newManagementScope
("\" + "remote computer name or IP address" + "\\ root\\ cimv2", options)
/ / Connect to a remote computer with a given manager username and password
Scope.Connect ()
two。 It is possible to perform WMI control on a remote computer:
System.Management.ObjectQueryoq=newSystem.Management.
ObjectQuery ("SELECT*FROMWin32_OperatingSystem")
ManagementObjectSearcherquery1=newManagementObjectSearcher (scope,oq)
/ / get WMI control
ManagementObjectCollectionqueryCollection1=query1.Get ()
3. Call WMI control to restart the remote computer:
Foreach (ManagementObjectmoinqueryCollection1) {string [] ss= {""}; / / restart the remote computer mo.InvokeMethod ("Reboot", ss);} Thank you for reading this article carefully. I hope the article "what is the theoretical knowledge of C# remote computer" shared by the editor will be helpful to you. At the same time, I also hope you will support us, pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 265
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.