2010年4月14日 星期三

修改電腦工作群組

using System;
using System.Management;
class program
{
  public static void Main()
  {
    string WorkgroupName = "ECLASS";
    ManagementObject manage = new ManagementObject(string.Format("Win32_ComputerSystem.Name='{0}'", Environment.MachineName));
    object[] args = { WorkgroupName, null, null, null };
    manage.InvokeMethod("JoinDomainOrWorkgroup", args);
    Console.WriteLine("Done! The Workgroup name will take effect after the next computer restart.");
    Console.ReadKey();
  }
}

沒有留言: