Breaking News
Loading...
Wednesday 13 March 2013

How to Get workgroup name of computer using C#.net,How to get information about workgroup of computer using C#.net

For getting information about workgroup of your computer follow step:
1)  Add reference "System.Management"
          (For showing how to add reference click here)
2)  Add name space
                 using System.Management;

/////////////////   CODE   /////////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Management;

namespace GetworkegroupCSharp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            // Getting information about worke group of computer
            ManagementObjectSearcher mosComputer = new ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem");
            foreach (ManagementObject moComputer in mosComputer.Get())
            {
                if (moComputer["Workgroup"] != null)
                     MessageBox.Show(moComputer["Workgroup"].ToString());
            }

        }
    }
}

/////////////////////////////////////////////////////////////////

Download Code : Workgroup.rar

See Also :
Follow Me On Facebook

-- /\/ir@\/  <(.'.)>

2 comments:

  1. Ur Post is really helping me.

    ReplyDelete
  2. Your Post is really helpfull to me...Thanx.

    ReplyDelete

Thanks for comment

 
Toggle Footer