Esempio n. 1
0
 private void bAddPCFromDomain_Click(object sender, EventArgs e)
 {
     if (WMI.IsDomainMember())
     {
         Debug.WriteLine(WMI.GetComputerDomainName());
     }
     else
     {
         Debug.WriteLine(WMI.GetComputerWorkgroupName());
         using (DirectoryEntry workgroup = new DirectoryEntry("WinNT://Workgroup"))
         {
             foreach (DirectoryEntry child in workgroup.Children)
             {
                 Debug.WriteLine(child.Name);
             }
         }
     }
 }