积极答复者
如何通过wmi query来确定哪个磁盘是SSD?

问题
-
Hi 工程师们,
你们好!
最近工作中有个问题:我需要在WinPe阶段查询当前笔记本是否存在NVMe协议的SSD,以及是否存在SATA协议的SSD,然后才能根据查询到的硬件信息对不同的磁盘进行不同的分区,并将OS安装在指定类型的磁盘中,那么问题就是我如何通过wmi query来确定哪个磁盘是SSD,以及是用的是什么协议?
我尝试通过wmi来查询BusType,DeviceId,MediaType,但是发现wmi无法看到SSD和HDD的区别,HDD和SSD的mediatype输出的结果都是相同的Fixed hard disk media
WMI query:
Root\CIMV2--Win32_DiskDrivePhysicalMedia--Instances--MediaType:Fixed hard disk media
但是PowerShell可以很轻松的查询到他们的类型
Get-PhysicalDisk | Select-Object BusType,DeviceId,MediaType,Size
然而我当前的Boot image未集成powershell组件,只能通过wmi去检测确认,请专家们能帮助我给我一个思路,谢谢!
- 已编辑 2019_315 2019年4月8日 8:21
答案
-
您好,
您可以尝试看看这个wmi query:
Root\Microsoft\Windows\Storage-MSFT_PhysicalDisk
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/stormgmt/msft-physicaldisk
MediaType
Data type: UInt16
Access type: Read-only
The media type of the physical disk.
Value
Meaning
0
Unspecified
3
HDD
4
SSD
5
SCM
Thanks,
Jenny
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已编辑 Jenny YanMicrosoft contingent staff 2019年4月9日 8:15
- 已标记为答案 2019_315 2019年4月16日 9:18
-
您好,
下方是我在测试机上的截图,供您参考。
此外您也可以尝试是用wmic query来获取磁盘信息:
wmic:root\cli>diskdrive get caption
希望对您有所帮助。
Best Regards,
Jenny
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已建议为答案 Jenny YanMicrosoft contingent staff 2019年4月15日 8:46
- 已标记为答案 2019_315 2019年4月16日 9:18
全部回复
-
您好,
您可以尝试看看这个wmi query:
Root\Microsoft\Windows\Storage-MSFT_PhysicalDisk
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/stormgmt/msft-physicaldisk
MediaType
Data type: UInt16
Access type: Read-only
The media type of the physical disk.
Value
Meaning
0
Unspecified
3
HDD
4
SSD
5
SCM
Thanks,
Jenny
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已编辑 Jenny YanMicrosoft contingent staff 2019年4月9日 8:15
- 已标记为答案 2019_315 2019年4月16日 9:18
-
您好,
下方是我在测试机上的截图,供您参考。
此外您也可以尝试是用wmic query来获取磁盘信息:
wmic:root\cli>diskdrive get caption
希望对您有所帮助。
Best Regards,
Jenny
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.- 已建议为答案 Jenny YanMicrosoft contingent staff 2019年4月15日 8:46
- 已标记为答案 2019_315 2019年4月16日 9:18
-
您好,
请问您的问题得到解决了吗?如果还需要其他协助请随时回复此帖或者另开新帖。
Best Regards,
Jenny
Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.