熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

通過WMI獲得硬盤和CPU的物理序列號

2022-06-13   來源: .NET編程 
獲得硬盤序列號

  Dim cmicWmi As New SystemManagementManagementObjectSearcher(SELECT * FROM Win_DiskDrive)

  Dim Uint As UInt

  For Each cmicWmiObj As ManagementObject In cmicWmiGet

  Uint = cmicWmiObj(signature)

  Next

  TextBoxText = UintToString

  獲得CPU序列號

  Dim Wmi As New SystemManagementManagementObjectSearcher(SELECT * FROM Win_Processor)

  Dim Uint As String

  For Each WmiObj As ManagementObject In WmiGet

  Uint = WmiObj(ProcessorId)

  Next

  TextBoxText = Uint

  獲得硬盤總容量

  Dim Wmi As New SystemManagementManagementObjectSearcher(SELECT * FROM Win_DiskDrive)

  Dim Uint As UInt

  For Each WmiObj As ManagementObject In WmiGet

  Uint = WmiObj(size)

  Next

  TextBoxText = UintToString

  首先引用SystemManagement然後在代碼中Imports SystemManagement


From:http://tw.wingwit.com/Article/program/net/201311/12787.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.