Start New Discussion within our Software Development Community

Hey Guys,

Ok so here is my problem, i have written a failrly long batch file that automates a lot of the jobs i have to do to new machines when built (im a PC Tech) and one of the things it does is tells you your processor arcitecture type via the system var %PROCESSOR_ARCHITECTURE%, now i've been doing a bit of reading and found that the only real way of finding that out in vb is via WMI now i was wondering as im new to this if someone could help me out, im not asking you to write the code for me but maybe point me in the right direction of some basic and easily understandable tutorials, or write some code and comment it so i know whats happening.

Cheers,
James

take a look at the class [Win32_Processor]
take a look at the field [Architecture] and see what each value (which is a number) means
http://msdn.microsoft.com/en-us/library/aa394373(VS.85).aspx

Dim con As ConnectionOptions = New ConnectionOptions
Dim machineName As String = System.Environment.MachineName
Dim mss As ManagementScope = New ManagementScope("\\" & _
                                machineName & _
                                "\root\cimv2", con)
Dim oqj As ObjectQuery = _
    New ObjectQuery("SELECT * FROM Win32_processor")
Dim mos As ManagementObjectSearcher = New ManagementObjectSearcher(mss, oqj)
Dim queryCollection As ManagementObjectCollection = mos.Get

Dim Architecture As String = ""
Architecture = queryCollection(0)("Architecture").ToString()
MsgBox(Architecture)

and you can use other classes to get other information in the same way

hope this helps

This article has been dead for over six months. Start a new discussion instead.