title: Getting HDD info only returns C drive info none others. c#
body: <p>I am putting together a program that pulls out a bunch of info from a PC and sends it to a server. I am currently working on trying to pull hdd info from the pc that has multiple drives but i can only get it to work with the first drive. Below is the code that pulls out the actual drive info and below that is the code that writes it out to console:</p>
  
  <pre><code>public static string CurrentDiskUsage()
      {
          DriveInfo[] drives = DriveInfo.GetDrives();
          foreach (DriveInfo drive in drives)
          {
              try
              {
  
                  if (drive.IsReady)
                  {
                      double result = 100 * (double) drive.TotalFreeSpace / drive.TotalSize;
                      result = Math.Round(result, 2, MidpointRounding.AwayFromZero);
                      string driveInformation = null;
                      driveInformation += drive.Name + "\n" + drive.DriveFormat + "\n" + "Drive total size: " + FormatBytes(drive.TotalSize) + "\n" + "Drive total free space: " + FormatBytes(drive.TotalFreeSpace) + "\n" + "Free space as percentage: " + result + "% \n ";
                      return driveInformation;
                  }
              }
              catch (Exception e)
              {
                  return "Fail";
                  Console.WriteLine(e);
              }
          }
  
          return "Fail";
      }
  </code></pre>
  
  <p><strong>Writes info to console</strong></p>
  
  <pre><code>String[] Content  = new string[7]; 
  
          Content[0] = reportFunctions.GetOsName();
          Content[1] = reportFunctions.IsSoftwareInstalled();
          Content[2] = reportFunctions.CurrentLoggedInUser();
          Content[3] = reportFunctions.GetPcName();
          Content[4] = reportFunctions.CurrentDiskUsage();
  
          int i = 0;
          while (i &lt; 6)
          {
              Console.WriteLine(Content[i]);
              i++;
          }
  }
  </code></pre>