获取用于IDE和SATA的H/D序列号(非批量序列号)

编程入门 行业动态 更新时间:2024-10-11 19:25:18
本文介绍了获取用于IDE和SATA的H/D序列号(非批量序列号)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何在VB.NET中读取IDE和SATA驱动器的硬盘序列号? (我不需要卷序列号).

How can I read the hard disk serial number for IDE and SATA drives in VB.NET? (I don't want the volume serial number).

如果可能,应在没有管理权限的情况下为XP和Vista收集此信息.

This info should be gathered both for XP and Vista if possible without administrative rights.

推荐答案

您可以使用 WMI (Windows管理规范)是这样的:

You can use WMI (Windows Management Instrumentation) like this:

Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia") For Each mo As ManagementObject In mos.Get() Dim serial As String = mo("SerialNumber").ToString() Next

尽管如此,我已经读过有关使用WMI不返回序列号的情况.实现此目的的另一种方法是通过平台调用服务(PInvoke).

Although, I've read about cases in which no serial number is returned using WMI. Another way to accomplish this would be through Platform Invocation Services (PInvoke).

此文章包括下载,作者在其中实现了 CreateFile()和 DeviceIoControl()以便通过VB .NET中的Interop服务提取驱动器信息.

This article includes a download in which the author implements CreateFile() and DeviceIoControl() to extract drive information through Interop services in VB .NET.

要使用上述概述的方法之一,您将需要具有ADMIN权限,可以找到一个似乎可以绕过此方法的实用程序此处.如果您喜欢冒险,可以阅读C ++/Win32 源代码. (签出功能'ReadPhysicalDriveInNTWithZeroRights()')

To use either of the above outlined methods you will need ADMIN rights, a utility which seems to circumvent this can be found here. If your feeling adventurous the C++/Win32 source code is available for you to peruse. (Check out the function 'ReadPhysicalDriveInNTWithZeroRights()')

更多推荐

获取用于IDE和SATA的H/D序列号(非批量序列号)

本文发布于:2023-10-29 00:57:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1538234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序列号   批量   IDE   SATA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!