Saturday, December 4, 2010

Microsoft Certification terms.

 Microsoft Certified Professional (MCP),
Microsoft Certified IT Professional (MCITP),
Microsoft Certified Master(MCM),
Microsoft Certified architect (MCA)
Microsoft Certified Application Developer (MCAD),
Microsoft Certified Solution Developer (MCSD),
Microsoft Certified Technology Specialist (MCST),
Microsoft Certified Professional Developer (MCPD),
Microsoft Certified Systems Administrator (MCSA),
Microsoft Certified Database Administrator (MCDBA) ,
Microsoft Certified Desktop Support Technician(MCDST),
Microsoft Certified Application Specialist(MCAS)
Microsoft Certified Trainer(MCT),
Microsoft Certified Systems Engineer(MCSE),
Microsoft Office Specialist (MOS)

Thursday, December 2, 2010

Get System Processor Id for some validations

Firstly Make sure that you have added system.Management namespace and assembly.

public static string GetProcessorID()
{

string sProcessorID = "";

string sQuery = "SELECT ProcessorId FROM Win32_Processor";

ManagementObjectSearcher oManagementObjectSearcher = new ManagementObjectSearcher(sQuery);

ManagementObjectCollection oCollection = oManagementObjectSearcher.Get();
foreach (ManagementObject oManagementObject in oCollection)

{

sProcessorID = (string)oManagementObject["ProcessorId"];

}
return (sProcessorID);

}

Get list of Windows Services

ServiceController[] services = ServiceController.GetServices();

Sunday, November 28, 2010

Read SQl Server Name

using Microsoft.SqlServer.Management.Smo;

protected void Button1_Click(object sender, EventArgs e)
    {
        DataTable dt = SmoApplication.EnumAvailableSqlServers(false);
        if (dt.Rows.Count > 0)
        {
            foreach (DataRow dr in dt.Rows)
            {
                Response.Write(dr["Name"].ToString() + "
");
            }
        }
    }
 
Note: You have to add a Reference of Microsoft.SqlServer.Smo dll. 

Unique Identifier for a computer

There are so many unique identifier. You may use Processor ID, any device Serial No. like Hard Drive Serial No. etc.

Please check the following code to read the ProcessorID:

public string GetMachineId()
    {
        string cpuInfo = String.Empty;
        ManagementClass managementClass = new ManagementClass("Win32_Processor");
        ManagementObjectCollection managementObjCol = managementClass.GetInstances();
        foreach (ManagementObject managementObj in managementObjCol)
        {
            if (cpuInfo == String.Empty)
            {
                cpuInfo = managementObj.Properties["ProcessorId"].Value.ToString();
            }
        }
        return cpuInfo;
    }


Note: You must add a reference of System.Management Assembly to use the above program.

Thursday, November 25, 2010

How to find the system is connected in LAN or not ?

 
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.Diagnostics;
using System.IO;

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

        private void Form1_Load(object sender, EventArgs e)
        {
      
 
 
//Gets the machine names that are connected on LAN  
  
Process netUtility = new Process();  
  
netUtility.StartInfo.FileName = "net.exe";  
  
netUtility.StartInfo.CreateNoWindow = true;  
  
netUtility.StartInfo.Arguments = "view";  
  
netUtility.StartInfo.RedirectStandardOutput = true;  
  
netUtility.StartInfo.UseShellExecute = false;  
  
netUtility.StartInfo.RedirectStandardError = true;  
  
netUtility.Start();  
  
   
  
StreamReader streamReader = new StreamReader(netUtility.StandardOutput.BaseStream, netUtility.StandardOutput.CurrentEncoding);  
  
   
  
string line = "";  
  
while ((line = streamReader.ReadLine()) != null)  
  
{  
  
      if (line.StartsWith("\\"))  
  
      {  
  
           listBox1.Items.Add(line.Substring(2).Substring(0, line.Substring(2).IndexOf(" ")).ToUpper());  
  
      }  
  
}  
  
streamReader.Close();  
netUtility.WaitForExit(1000);  


        }
    }
}