简体   繁体   中英

how can i get the info of ssd in asp.net code?

i have this code

managementObjectSearcher ComponentInfo = new ManagementObjectSearcher ("SELECT * FROM Win32_DiskDrive");

What should i do to get the info of the ssd ?

What kind of info are you looking for exactly? There's a lot of info here: https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-diskdrive and also here: https://docs.microsoft.com/en-us/windows/desktop/cimwin32prov/win32-logicaldisk . You can run any query you want by running a foreach as such:

foreach (managementobject os in ComponentInfo.Get())
{
   //useful query information from os here...
}

I've actually just finished using this code to get the partitions of each drive and their relative free space to calculate the percent free space. I've also used it to get the model and serial number of the drives. You can do a lot here, just point and shoot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM