如何远程重启计算机?

maldini3328 2002-05-29 12:09:54
马金虎的文章根本没法实现嘛,正式版中根本没有嘛management类
有在正式版中实现了的吗?
...全文
136 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
tjsguyf 2002-05-30
  • 打赏
  • 举报
回复
对!就是!!
sundy26 2002-05-30
  • 打赏
  • 举报
回复
using System;
using System.Management;

namespace WMI3
{
/// <summary>
/// Summary description for Class1.
/// </summary>

class Class1
{
static void Main(string[] args)
{
Console.WriteLine("Computer details retrieved using Windows Management Instrumentation (WMI)");
Console.WriteLine("Written 02/01/02 By John O'Donnell - csharpconsulting@hotmail.com");
Console.WriteLine("========================================
=================================");
//Connect to the remote computer
ConnectionOptions co = new ConnectionOptions();
co.Username = "john";
co.Password = "john";
System.Management.ManagementScope ms = new System.Management.ManagementScope("\\\\192.168.1.2\\root\\cimv2", co);

//Query remote computer across the connection
System.Management.ObjectQuery oq = new System.Management.ObjectQuery("SELECT * FROM Win32_OperatingSystem");

ManagementObjectSearcher query1 = new ManagementObjectSearcher(ms,oq);
ManagementObjectCollection queryCollection1 = query1.Get();

foreach( ManagementObject mo in queryCollection1 )
{
string[] ss={""};
mo.InvokeMethod("Reboot",ss);
Console.WriteLine(mo.ToString());
}
}
}
}
acptvc 2002-05-30
  • 打赏
  • 举报
回复
感谢使用微软产品。

正式版本中所有的Management classes在System.Management Namespace中。
在使用之前你需要add references to System.Management.dll .

- 微软全球技术中心 VC技术支持

本贴子以“现状”提供且没有任何担保,同时也没有授予任何权利。具体事项可参见使用条款(http://support.microsoft.com/directory/worldwide/zh-cn/community/terms_chs.asp)。
为了为您创建更好的讨论环境,请参加我们的用户满意度调查(http://support.microsoft.com/directory/worldwide/zh-cn/community/survey.asp?key=(S,49854782))。
computer5816361 2002-05-30
  • 打赏
  • 举报
回复
分太少了,我会
yellowwee 2002-05-29
  • 打赏
  • 举报
回复
up!

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧