【问题标题】:Read drive information of virtual machine with c#用c#读取虚拟机的驱动信息
【发布时间】:2017-06-27 13:17:25
【问题描述】:

我仍在开发一个小程序,我正在尝试监控各种计算机数据,例如温度、时钟速度......(CPU、GPU、驱动器、RAM)。数据主要通过 OpenHardwareMonitor 的 WMI 接口接收,这工作正常。但是 OHM 没有提供任何有用的 Drive 数据,所以我目前正在从 windows WMI 界面读取它。 (Win32_DiskDrive)

如果您在物理机上工作,一切正常。但是当我在虚拟机中尝试时,我根本没有收到任何驱动器数据。

您知道我应该怎么做才能在虚拟机上获取重要的驱动器数据吗?我需要使用的空间和虚拟驱动器的总驱动器空间。此外,如果我能够获得计算机物理驱动器的温度和 SMART 状态,那就太好了。

感谢您的帮助!

【问题讨论】:

    标签: c# monitoring vmware


    【解决方案1】:

    您是否尝试过使用System.IO 功能?

    看看here,可能就是你需要的!

    这允许您执行以下操作(来自链接):

        // You can also use System.Environment.GetLogicalDrives to
        // obtain names of all logical drives on the computer.
        System.IO.DriveInfo di = new System.IO.DriveInfo(@"C:\");
        Console.WriteLine(di.TotalFreeSpace);
        Console.WriteLine(di.VolumeLabel);
    
        // Get the root directory and print out some information about it.
        System.IO.DirectoryInfo dirInfo = di.RootDirectory;
        Console.WriteLine(dirInfo.Attributes.ToString());
    

    此外,在您的问题中包含显示您实际使用/无效的代码会很不错。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-10
      • 1970-01-01
      • 2021-06-14
      • 2010-09-08
      • 2011-06-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多