Friday 15 March 2013

How to get system information

The attached source code returns the system information for your machine such as machine name, operating system, current user and logical drives.

//Gives the Directory which is using by ur systemlbl13.Text=Environment.CurrentDirectory;

//Shows u the system Directorylbl12.Text=Environment.SystemDirectory;

//show the version of the systemlbl11.Text=Convert.ToString(Environment.Version);lbl10.Text=Convert.ToString(Environment.OSVersion);

//Shows the Machine Namelbl9.Text=Environment.MachineName;lbl8.Text=Convert.ToString(Environment.WorkingSet);

//Command Line Argumentsstring [] args=Environment.GetCommandLineArgs();for (int x=0;x<args.Length;x++){MessageBox.Show(args[x],"Command Line Arguments",MessageBoxButtons.OK,
MessageBoxIcon.Information,
MessageBoxDefaultButton.Button1,MessageBoxOptions
.ServiceNotification);
}


//Logical Drivesstring []drives=Environment.GetLogicalDrives();for(int x=0;x<drives.Length;x++){MessageBox.Show(drives[x],"LogicalDrives",MessageBoxButtons.OK,
MessageBoxIcon.Information);
}

 // Display the Current User NameMessageBox.Show(Environment.UserName,"Current User Name",MessageBoxButtons.OK,MessageBoxIcon.Information);lbl16.Text=Environment.StackTrace;

//Shows the Domain name of the systemlbl18.Text=Environment.UserDomainName;

This code gives you information about the Processor Id.
lblPid.Text = HardwareInfo.GetProcessorId();
 
This code gives you the HDD Serial No.
lblHDD.Text = HardwareInfo.GetHDDSerialNo();
 
This code gives you the Board Maker.
lblBM.Text = HardwareInfo.GetBoardMaker();
 
This code gives you the Information about BIOS Maker.
lblBios.Text = HardwareInfo.GetBIOSmaker();
 
This code gives you the Information about RAM Memory.
lblPM.Text = HardwareInfo.GetPhysicalMemory();
 
This code gives you the Information about CPU Speed.
lblCS.Text = HardwareInfo.GetCpuSpeedInGHz().ToString();
 
This code gives you the Information about CPU Maker.
lblCM.Text = HardwareInfo.GetCPUManufacturer();

No comments:

Post a Comment