Friday, February 6, 2009

Coding for displaying details of OnBoard

C#.net Code

ManagementObjectSearcher on_board_details = new ManagementObjectSearcher("root\\CIMV2", "select * from Win32_OnBoardDevice");

foreach (ManagementObject board_details in on_board_details.Get())
{
Response.Write("DESCRIPTION : "+board_details["Description"].ToString()+"
"); Response.Write("DEVICE TYPE : "+board_details["DeviceType"].ToString() + "
"); Response.Write("TAG : "+board_details["Tag"].ToString() + "
"); Response.Write("ENABLED :"+board_details["Enabled"].ToString()+"
"); Response.Write("--------------------------------
");
}

}

JavaScrip Code

function hard_ware()
 {
 var locator = new ActiveXObject ("WbemScripting.SWbemLocator");
  var service = locator.ConnectServer(".");
  var properties = service.ExecQuery("SELECT * FROM Win32_OnBoardDevice");
  var e = new Enumerator (properties);
 
  for (;!e.atEnd();e.moveNext ())
  {
  var p = e.item ();
  document.write( p.Description);
  document.write(p.DeviceType );
  document.write( p.Enabled );
  document.write( p.Tag );
 }
 }

No comments: