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. Visual Studio 2015 & .NET 4.6
  4. processor id

processor id

Scheduled Pinned Locked Moved Visual Studio 2015 & .NET 4.6
csharphelptutorial
5 Posts 4 Posters 2 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.
  • S Offline
    S Offline
    srinivasankrishnaa
    wrote on last edited by
    #1

    guys i have tried many codes to find the processor id but i was not able to find it.............. does any one know how to code it in vb.net help me with a code........... plz...........

    M 2 Replies Last reply
    0
    • S srinivasankrishnaa

      guys i have tried many codes to find the processor id but i was not able to find it.............. does any one know how to code it in vb.net help me with a code........... plz...........

      M Offline
      M Offline
      Mike Meinz
      wrote on last edited by
      #2

      The following code was tested using Visual Basic .NET 2012:

          Option Strict Off
          Option Explicit Off
      

      ...

          Dim strComputer As String = "."
          Dim objWMIService As Object = GetObject("winmgmts:" \_
           & "{impersonationLevel=impersonate}!\\\\" & strComputer & "\\root\\cimv2")
      
          Dim colProcessors As Object = objWMIService.ExecQuery("Select \* from Win32\_Processor")
          For Each objProcessor In colProcessors
              Debug.WriteLine("  Manufacturer: " & objProcessor.Manufacturer)
              Debug.WriteLine("  Name: " & objProcessor.Name)
              Debug.WriteLine("  Description: " & objProcessor.Description)
              Debug.WriteLine("  ProcessorID: " & objProcessor.ProcessorID)
              Debug.WriteLine("  Architecture: " & objProcessor.Architecture)
              Debug.WriteLine("  AddressWidth: " & objProcessor.AddressWidth)
              Debug.WriteLine("  NumberOfCores: " & objProcessor.NumberOfCores)
              Debug.WriteLine("  DataWidth: " & objProcessor.DataWidth)
              Debug.WriteLine("  Family: " & objProcessor.Family)
              Debug.WriteLine("  MaximumClockSpeed: " & objProcessor.MaxClockSpeed)
          Next
      

      Result on my computer:

      Manufacturer: GenuineIntel
      Name: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
      Description: Intel64 Family 6 Model 58 Stepping 9
      ProcessorID: BFAAFBCD002316D1
      Architecture: 9
      AddressWidth: 64
      NumberOfCores: 4
      DataWidth: 64
      Family: 198
      MaximumClockSpeed: 2694

      Source: Microsoft Visual Studio 2012 Help File for Win32_Processor[^]

      L Richard DeemingR 2 Replies Last reply
      0
      • M Mike Meinz

        The following code was tested using Visual Basic .NET 2012:

            Option Strict Off
            Option Explicit Off
        

        ...

            Dim strComputer As String = "."
            Dim objWMIService As Object = GetObject("winmgmts:" \_
             & "{impersonationLevel=impersonate}!\\\\" & strComputer & "\\root\\cimv2")
        
            Dim colProcessors As Object = objWMIService.ExecQuery("Select \* from Win32\_Processor")
            For Each objProcessor In colProcessors
                Debug.WriteLine("  Manufacturer: " & objProcessor.Manufacturer)
                Debug.WriteLine("  Name: " & objProcessor.Name)
                Debug.WriteLine("  Description: " & objProcessor.Description)
                Debug.WriteLine("  ProcessorID: " & objProcessor.ProcessorID)
                Debug.WriteLine("  Architecture: " & objProcessor.Architecture)
                Debug.WriteLine("  AddressWidth: " & objProcessor.AddressWidth)
                Debug.WriteLine("  NumberOfCores: " & objProcessor.NumberOfCores)
                Debug.WriteLine("  DataWidth: " & objProcessor.DataWidth)
                Debug.WriteLine("  Family: " & objProcessor.Family)
                Debug.WriteLine("  MaximumClockSpeed: " & objProcessor.MaxClockSpeed)
            Next
        

        Result on my computer:

        Manufacturer: GenuineIntel
        Name: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
        Description: Intel64 Family 6 Model 58 Stepping 9
        ProcessorID: BFAAFBCD002316D1
        Architecture: 9
        AddressWidth: 64
        NumberOfCores: 4
        DataWidth: 64
        Family: 198
        MaximumClockSpeed: 2694

        Source: Microsoft Visual Studio 2012 Help File for Win32_Processor[^]

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi Thanks for above code code is relay useful for most of people. :thumbsup:

        Vivek Singh Software Engineer

        1 Reply Last reply
        0
        • M Mike Meinz

          The following code was tested using Visual Basic .NET 2012:

              Option Strict Off
              Option Explicit Off
          

          ...

              Dim strComputer As String = "."
              Dim objWMIService As Object = GetObject("winmgmts:" \_
               & "{impersonationLevel=impersonate}!\\\\" & strComputer & "\\root\\cimv2")
          
              Dim colProcessors As Object = objWMIService.ExecQuery("Select \* from Win32\_Processor")
              For Each objProcessor In colProcessors
                  Debug.WriteLine("  Manufacturer: " & objProcessor.Manufacturer)
                  Debug.WriteLine("  Name: " & objProcessor.Name)
                  Debug.WriteLine("  Description: " & objProcessor.Description)
                  Debug.WriteLine("  ProcessorID: " & objProcessor.ProcessorID)
                  Debug.WriteLine("  Architecture: " & objProcessor.Architecture)
                  Debug.WriteLine("  AddressWidth: " & objProcessor.AddressWidth)
                  Debug.WriteLine("  NumberOfCores: " & objProcessor.NumberOfCores)
                  Debug.WriteLine("  DataWidth: " & objProcessor.DataWidth)
                  Debug.WriteLine("  Family: " & objProcessor.Family)
                  Debug.WriteLine("  MaximumClockSpeed: " & objProcessor.MaxClockSpeed)
              Next
          

          Result on my computer:

          Manufacturer: GenuineIntel
          Name: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz
          Description: Intel64 Family 6 Model 58 Stepping 9
          ProcessorID: BFAAFBCD002316D1
          Architecture: 9
          AddressWidth: 64
          NumberOfCores: 4
          DataWidth: 64
          Family: 198
          MaximumClockSpeed: 2694

          Source: Microsoft Visual Studio 2012 Help File for Win32_Processor[^]

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          Alternatively, if you want to do this the .NET way rather than the VBScript way, add a reference to the System.Management assembly, import the System.Management namespace[^], and use:

          Using searcher As New ManagementObjectSearcher("Select * from Win32_Processor")
          Using processors As ManagementObjectCollection = searcher.Get()
          For Each processor As ManagementObject In processors
          Console.WriteLine("Manufacturer: {0}", processor("Manufacturer"))
          Console.WriteLine("Name: {0}", processor("Name"))
          Console.WriteLine("Description: {0}", processor("Description"))
          Console.WriteLine("ProcessorID: {0}", processor("ProcessorID"))
          Console.WriteLine("Architecture: {0}", processor("Architecture"))
          Console.WriteLine("AddressWidth: {0}", processor("AddressWidth"))
          Console.WriteLine("NumberOfCores: {0}", processor("NumberOfCores"))
          Console.WriteLine("DataWidth: {0}", processor("DataWidth"))
          Console.WriteLine("Family: {0}", processor("Family"))
          Console.WriteLine("MaxClockSpeed: {0}", processor("MaxClockSpeed"))
          Console.WriteLine()
          Next
          End Using
          End Using


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          • S srinivasankrishnaa

            guys i have tried many codes to find the processor id but i was not able to find it.............. does any one know how to code it in vb.net help me with a code........... plz...........

            M Offline
            M Offline
            Mike Meinz
            wrote on last edited by
            #5

            Great response from Richard Deeming. I used that to create a version that does not require Option Strict Off and Option Explicit Off. Both can be set to on with this version:

                Dim objSearcher As New ManagementObjectSearcher("Select \* from Win32\_Processor")
                Dim colProcessors As ManagementObjectCollection = objSearcher.Get
                For Each objProcessor As ManagementObject In colProcessors
                    Debug.WriteLine("Manufacturer: " & DirectCast(objProcessor("Manufacturer"), String))
                    Debug.WriteLine("Name: " & DirectCast(objProcessor("Name"), String))
                    Debug.WriteLine("Description: " & DirectCast(objProcessor("Description"), String))
                    Debug.WriteLine("ProcessorID: " & DirectCast(objProcessor("ProcessorID"), String))
                    Debug.WriteLine("Architecture: " & CStr(objProcessor("Architecture")))
                    Debug.WriteLine("AddressWidth: " & CStr(objProcessor("AddressWidth")))
                    Debug.WriteLine("NumberOfCores: " & CStr(objProcessor("NumberOfCores")))
                    Debug.WriteLine("DataWidth: " & CStr(objProcessor("DataWidth")))
                    Debug.WriteLine("Family: " & CStr(objProcessor("Family")))
                    Debug.WriteLine("MaximumClockSpeed: " & CStr(objProcessor("MaxClockSpeed")))
                Next
            
            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