硬盘序列号怎么获取?
如题~前辈们帮帮忙,谢谢! 学会使用搜索 论坛里有解决办法,但是我现在想知道如果读取U盘的 标题与实际问题不符合 :face (27): $USBSerials = _GetDrivesSerial("removable")MsgBox(64, "USB SN", $USBSerials)
Func _GetDrivesSerial($Type)
Local $DrivesArr = DriveGetDrive($Type), $SerialsString, $iDrv
If IsArray($DrivesArr) Then
For $iDrv = 1 To $DrivesArr
If $DrivesArr[$iDrv] <> "a:" And $DrivesArr[$iDrv] <> "b:" Then
$SerialsString &= "The serial Number of USB Drive <" & StringUpper($DrivesArr[$iDrv]) & "\> is {" & _
DriveGetSerial($DrivesArr[$iDrv]) & "}" & @CR
EndIf
Next
Return $SerialsString
Else
SetError(1)
Return -1
EndIf
EndFunc
试试看 谢谢LZ的分享 不成功................. 回复 7# the886
有提示没有 呵呵,温习一下。。 终于看到一个简单的 硬盘序列号获取 谢谢 我用外挂dll.. 谢谢分享。。。
刚才找错地方了 重新贴出 Win32_PhysicalMedia
本帖最后由 lainline 于 2010-2-13 08:26 编辑; 生成于 AutoIt Scriptomatic
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$Output = $Output & "Computer: " & $strComputer& @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMedia", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Output = $Output & "Capacity: " & $objItem.Capacity & @CRLF
$Output = $Output & "Caption: " & $objItem.Caption & @CRLF
$Output = $Output & "CleanerMedia: " & $objItem.CleanerMedia & @CRLF
$Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
$Output = $Output & "Description: " & $objItem.Description & @CRLF
$Output = $Output & "HotSwappable: " & $objItem.HotSwappable & @CRLF
$Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
$Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
$Output = $Output & "MediaDescription: " & $objItem.MediaDescription & @CRLF
$Output = $Output & "MediaType: " & $objItem.MediaType & @CRLF
$Output = $Output & "Model: " & $objItem.Model & @CRLF
$Output = $Output & "Name: " & $objItem.Name & @CRLF
$Output = $Output & "OtherIdentifyingInfo: " & $objItem.OtherIdentifyingInfo & @CRLF
$Output = $Output & "PartNumber: " & $objItem.PartNumber & @CRLF
$Output = $Output & "PoweredOn: " & $objItem.PoweredOn & @CRLF
$Output = $Output & "Removable: " & $objItem.Removable & @CRLF
$Output = $Output & "Replaceable: " & $objItem.Replaceable & @CRLF
$Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF
$Output = $Output & "SKU: " & $objItem.SKU & @CRLF
$Output = $Output & "Status: " & $objItem.Status & @CRLF
$Output = $Output & "Tag: " & $objItem.Tag & @CRLF
$Output = $Output & "Version: " & $objItem.Version & @CRLF
$Output = $Output & "WriteProtectOn: " & $objItem.WriteProtectOn & @CRLF
if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
$Output=""
Next
Else
Msgbox(0,"WMI 输出","No WMI Objects Found for class: " & "Win32_PhysicalMedia" )
Endif
Func WMIDateStringToDate($dtmDate)
Return (StringMid($dtmDate, 5, 2) & "/" & _
StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
& " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate,13, 2))
EndFunc 函数参考
DriveGetSerial
--------------------------------------------------------------------------------
返回指定驱动器的序列号.
DriveGetSerial ( "路径" )
参数
路径 要获得序列号信息的驱动器盘符.
返回值
成功: 以字符串的形式返回指定驱动器的序列号.
失败: 把 @error 设为 1.
注意/说明
找到的这个驱动器序列号不是硬件序列号, 它是这个驱动器的 Windows 卷ID(Volume ID). 回复 5# netegg
这那是硬盘序列号啊,是卷序列号,格式化后会变。
页:
[1]