-2

In Windows 'Disk Management' there is a property of a drive that is 'online/offline'. How can I expose this property in for remote hardware? I know were it is not; it is not in: win32_logicaldisk, win32_diskdrive, CIM_LogicalDisk, & CIM_LogicalDevice nor is it in System.IO.DriveInfo

OpenAll
  • 13
  • 3

2 Answers2

1

Do you mean something like this:

DriveInfo drive = GetDrives();

foreach(DriveInfo d in drive)
{
    Console.WriteLine("Drive {0}", d.Name);
    Console.WriteLine" File Type: {0}", d.DriveType);

    if(d.IsReady == true)
    {
         Console.WriteLine(" Volume Label: {0}", d.VolumeLabel);
    }
}

You can find a great example, straight off MSDN. Essentially if it detects an avaliable drive that is Ready it will display information about it. If not, then it won't display anything.

You can obviously modify this even further.

You can also implement Powershell or WMI Scripts from C# to accomplish the task. You have a lot of flexibility in this instance.

Hope that helps.

Greg
  • 11,302
  • 2
  • 48
  • 79
0

If you are using c# you should be able to get all this information through WMI.

Angelom
  • 2,413
  • 1
  • 15
  • 8