使用C#查找硬盘的序列号 [英] Find Serial no of hard disk using C#

查看:286
本文介绍了使用C#查找硬盘的序列号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我正在尝试获取使用Win32_PhysicalMedia的硬盘的序列号
此类代码在ide硬盘上可以正常工作.
但是,当我将它用于SATA时,它不会显示序列号.我下载了其他显示序列号的软件,​​出于安全原因,我想使用硬盘的序列号.

如果有任何想法请帮助我.....

对不起,英语不好

谢谢

Hi to all

I am trying to fetch serialno of hard disk I used Win32_PhysicalMedia
class the code is working perfectly fine with ide hard disk.
But when I use it for SATA it does not display the serial no. I downloaded other softwares which display serial no I want to use serial no of hard disk for security reasons for my softwares.

If any body have any Idea please help Me.....

Sorry for bad english

Thanks

推荐答案

您知道每次重新格式化驱动器时序列号都会更改,对吧?
You do know that the serial number changes every time you reformat the drive, right?


您好,

这里要小心,有几个陷阱.

1.
每个分区都有一个序列号,该序列号很容易获得.在格式化分区时会对其进行分配,因此它会随着时间的变化而变化.

大多数Google搜索结果都倾向于指向分区的序列号(这是最容易获得的),而始终没有弄清楚这一点.

2.
每个物理磁盘都有一个数据结构,其中一个字段保存物理序列号.它需要供应商的协作,这通常不是问题. AFAIK的数量不能随时间变化(除非您当然要更换设备).

有多种获取方式(使用WMI,使用设备级文件操作),但是每种方式都需要在Vista和更高版本的系统上进行升级.

:)
Hi,

be careful here, there are several traps.

1.
each partition has a serial number, that one is easy to get. It gets assigned when the partition gets formatted, hence it can change over time.

Most Google hits tend to point to the partition''s serial number (as that is the easiest to get), without always making that clear.

2.
each physcial disk has a data structure, with one field holding the physical serial number. It requires the vendor''s collaboration, which normally isn''t a problem. AFAIK the number cannot change over time (unless you replace the device of course).

There are several ways to get it (using WMI, using device-level file operations), however each of those would require elevation on Vista and later systems.

:)


您可以下载WMI资源管理器( http://www.ks-soft.net/hostmon.eng/wmi/index.htm [ ^ ]),然后自行查找序列号.
希望这会有所帮助.
祝一切顺利!
You can download WMI explorer (http://www.ks-soft.net/hostmon.eng/wmi/index.htm[^]) and find the serial number by yourself.
Hope this will help.
Best wishes!


这篇关于使用C#查找硬盘的序列号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆