Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

Hi

I know how to get processor id via vb.net using .net framework 2.0 and at windows xp to windows 7 all dual core or single cpu and all is 64 bit or 32 bit system.

But now i want to get processor id via vb.net using .net framework 4 beta 2 and visual studio 2010 beta 2.

i want vb.net code for windows application created via above ms vs 2010 for 64 bit windows machine with windows server 2008 and has 8 cpu

my above vs 2005 code not able to get processor id from that 8 cpu machine

MAKEUSEOF VIDEO OF THE DAY
SCROLL TO CONTINUE WITH CONTENT

i use the code below-

-------------------------

Imports System

Imports System.Management

Public Class CPUId

Public Shared Function GetProcessorId() As String

Dim strProcessorId As String

Dim query As New SelectQuery("Win32_processor")

Dim search As New ManagementObjectSearcher(query)

Dim info As ManagementObject

For Each info In search.Get()

strProcessorId = info("processorId").ToString()

Next

Return strProcessorId

End Function

End Class

---------------

this works with single or dual core processor machine

also with windows server 2008 with dual core it works also tested ok with windows 7 64 bit dual core.

but i want with 8 cpu machine with 64 bit version of windows server 2008 and didn't work it

i also tried motherboard id but it also not work with 8 cpu ...

---------------

' i also create namespace for this class

Imports System

Imports System.Management

Public Class MotherBoardID

Public Shared Function GetMotherBoardID() As String

Dim strMotherBoardID As String

Dim query As New SelectQuery("Win32_BaseBoard")

Dim search As New ManagementObjectSearcher(query)

Dim info As ManagementObject

For Each info In search.Get()

strMotherBoardID = info("SerialNumber").ToString()

Next

Return strMotherBoardID

End Function

End Class

----------------------

can anyone help me

its really needed to me. .

Vivek Athalye
2010-02-20 16:10:00
Hi AshishWhat do you mean by it's not working? What is the output you are getting?Looking at the code it seems that you are assigning the value of info(”processorId”).ToString() to the same string variable. So logically your function is going to return the processorID from the LAST info object that is returned by search.Get().Please correct me if I've interpreted your code incorrectly.