Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Get CPU ID & HD Serial number

Get CPU ID & HD Serial number

Scheduled Pinned Locked Moved C#
helpcsharptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AlexB47
    wrote on last edited by
    #1

    Hi, I have a problem if I read CPU ID and HD serial number with P/Invoce. It possible read this property with .NET 2.0 class? Help me please ( possible with example :) ) Thanks a lot!

    Alex

    V S 2 Replies Last reply
    0
    • A AlexB47

      Hi, I have a problem if I read CPU ID and HD serial number with P/Invoce. It possible read this property with .NET 2.0 class? Help me please ( possible with example :) ) Thanks a lot!

      Alex

      V Offline
      V Offline
      Vimalsoft Pty Ltd
      wrote on last edited by
      #2

      Yes try this

      Public Class Processor_ID
      Public Function Get_CPU_ID() As String
      Try
      Dim objMOS As ManagementObjectSearcher

              Dim objMOC As Management.ManagementObjectCollection
      
              Dim objMO As Management.ManagementObject
      
              objMOS = New ManagementObjectSearcher("Select \* From Win32\_Processor")
      
              objMOC = objMOS.Get
      
              For Each objMO In objMOC
                  MessageBox.Show("CPU ID = " & objMO("ProcessorID"))
              Next
      
              objMOS.Dispose()
      
              objMOS = Nothing
      
              objMO.Dispose()
      
              objMO = Nothing
      
          Catch ex As ApplicationException
      
              MessageBox.Show(ex.Message)
      
          End Try
      
      End Function
      

      End Class

      and Call the Function like this in your Form

      Dim strId As String
      Try
      Dim objID As New Processor_ID

              strId = objID.Get\_CPU\_ID()
      
              MessageBox.Show(strId)
      
          Catch ex As ApplicationException
      
              MessageBox.Show(ex.Message)
      
          End Try
      

      And that is in vb, its easy to convert it to C# Hope it Helps

      Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za

      1 Reply Last reply
      0
      • A AlexB47

        Hi, I have a problem if I read CPU ID and HD serial number with P/Invoce. It possible read this property with .NET 2.0 class? Help me please ( possible with example :) ) Thanks a lot!

        Alex

        S Offline
        S Offline
        sunspeed
        wrote on last edited by
        #3

        Look at this, it may help. http://www.codeproject.com/KB/system/GetHardwareInformation.aspx

        Der Staat mit der niedrigsten Geburtenrate ist nicht die Bundesrepublik, sondern der Vatikan.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups