1 Replies - 501 Views - Last Post: 05 February 2009 - 08:23 PM Rate Topic: -----

#1 Poornima Mani  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 178
  • Joined: 25-January 09

Server Drives

Post icon  Posted 05 February 2009 - 07:55 PM

Hi
i have used ManagementObjectSearcher class for listing the drives...
there is no error but it does not display the output....
please can anyone check the code and tell me whether this approach is right...If not please tell me what is wrong with this...and what modifications should i do to get required drives in the server?
private void button1_Click(object sender, EventArgs e)
		{
			try
			{
				ManagementObjectSearcher mosDisks = new ManagementObjectSearcher("SELECT name FROM Win32_DiskDrive");

				// Loop through each object (disk) retrieved by WMI

				foreach (ManagementObject moDisk in mosDisks.Get())
				{

					// Add the HDD to the list (use the Model field as the item's caption)

					listBox1.Items.Add(moDisk["Model"].ToString());

				}
			}
			catch (ManagementException me)
			{
				MessageBox.Show(me.ToString());
			}
		}



Is This A Good Question/Topic? 0
  • +

Replies To: Server Drives

#2 bodom658  Icon User is offline

  • Villiage Idiom
  • member icon

Reputation: 113
  • View blog
  • Posts: 1,123
  • Joined: 22-February 08

Re: Server Drives

Posted 05 February 2009 - 08:23 PM

You seem like you are on the right track... I'd check the MSDN library.

I have not personally worked with server drives in C#
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1