Solved

Any One Have Know Of A Good System Information Class

Posted on 2006-10-19
17
267 Views
Last Modified: 2010-04-23
I am running a windows client program that uses web services for data.
I would like to collect machine information similar to that displayed in the properties window on my computer.

I have found several functions for just getting the OS name, none by the have worked properly on my media edition of xp.
the properties page display different information for total memory then the calls i have tried. They are close but not the same.

My question is does anyone know of a good class that returns extremely accurate system information.

I don't want to make this a couple of day project and believe I would only be re inventing the wheel.

hope someone can help.

greg

0
Comment
Question by:Autoeforms
  • 7
  • 6
  • 4
17 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17765014
use System.Management and WMI queries
--------------------------------------------------
Dim objWMI As New clsWMI()
With objWMI
      Debug.WriteLine("Computer Name = " & .ComputerName)
      Debug.WriteLine("Computer Manufacturer = " & .Manufacturer)
      Debug.WriteLine("Computer Model = " & .Model)
      Debug.WriteLine("OS Name = " & .OsName)
      Debug.WriteLine("OS Version = " & .OSVersion)
      Debug.WriteLine("System Type = " & .SystemType)
      Debug.WriteLine("Total Physical Memory = " & .TotalPhysicalMemory)
      Debug.WriteLine("Windows Directory = " & .WindowsDirectory)
End With


'To use this class you must add a reference
'to System.Management from the Project | References
'menu

Imports System.Management
Public Class clsWMI
    Private objOS As ManagementObjectSearcher
    Private objCS As ManagementObjectSearcher
    Private objMgmt As ManagementObject
    Private m_strComputerName As String
    Private m_strManufacturer As String
    Private m_StrModel As String
    Private m_strOSName As String
    Private m_strOSVersion As String
    Private m_strSystemType As String
    Private m_strTPM As String
    Private m_strWindowsDir As String

   
    Public Sub New()

        objOS = New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")
        objCS = New ManagementObjectSearcher("SELECT * FROM Win32_ComputerSystem")
        For Each objMgmt In objOS.Get

           
            m_strOSName = objMgmt("name").ToString()
            m_strOSVersion = objMgmt("version").ToString()
            m_strComputerName = objMgmt("csname").ToString()
            m_strWindowsDir = objMgmt("windowsdirectory").ToString()
        Next

        For Each objMgmt In objCS.Get
            m_strManufacturer = objMgmt("manufacturer").ToString()
            m_StrModel = objMgmt("model").ToString()
            m_strSystemType = objMgmt("systemtype").ToString
            m_strTPM = objMgmt("totalphysicalmemory").ToString()
        Next
    End Sub

    Public ReadOnly Property ComputerName()
        Get
            ComputerName = m_strComputerName
        End Get

    End Property
    Public ReadOnly Property Manufacturer()
        Get
            Manufacturer = m_strManufacturer
        End Get

    End Property
    Public ReadOnly Property Model()
        Get
            Model = m_StrModel
        End Get

    End Property
    Public ReadOnly Property OsName()
        Get
            OsName = m_strOSName
        End Get

    End Property

    Public ReadOnly Property OSVersion()
        Get
            OSVersion = m_strOSVersion
        End Get

    End Property
    Public ReadOnly Property SystemType()
        Get
            SystemType = m_strSystemType
        End Get

    End Property
    Public ReadOnly Property TotalPhysicalMemory()
        Get
            TotalPhysicalMemory = m_strTPM
        End Get

    End Property

    Public ReadOnly Property WindowsDirectory()
        Get
            WindowsDirectory = m_strWindowsDir
        End Get

    End Property

End Class


from:-
http://www.freevbcode.com/ShowCode.asp?ID=4571
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17765032
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17765037
The charms of google searches eh theGhost_k8 :)
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17765231
well kinger247,
its all about reply u can give !!
problem can have > 1 solution.. try to find new one....
let Autoeforms select the best 1 ... ;)
0
 
LVL 8

Author Comment

by:Autoeforms
ID: 17767327
what am i missing isn't it the same solution

g
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17767498
yes, we both replied at the same time !

funny how we got the same answer ;)
0
 
LVL 8

Author Comment

by:Autoeforms
ID: 17767833
it is

i was really hoping for a more polished solution
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17772392
Sometimes you get the same results at the same time (it just happens).

The solution is there, we don't know what you want to use the code for ... but you can easily work out how to extract the parts that you need.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17772411
hay kinger, u were 2 mins late.... check our timings....
 ha ha ha...
and to AUTOEFORMS...
   "My question is does anyone know of a good class that returns extremely accurate system information."
    one can reply in Yes/No
well i;ve replied in code ... not POLISHED !!!
frankly speaking no one.. i mean no one is gettin real POlished things ready..
not even me... you'll get scrap .. make poshied from it...
see this... i've got no returns... hope if u can reply... even non polished...
http://www.experts-exchange.com/Programming/Q_22028541.html
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17772459
I know I was 2 mins late, thats what I'm talking about !  ;)

As to a polished solution, I think some people can ask for to much ... ie, write the solution for them.
People should be pointed in the right direction, especially when the code is complicated and you have to learn what it does as to just cut-n-paste /run.

The code you showed Ghost is ample to go with, and a good solution, I was acually impressed with the link I've saved it for future use.

But alas I no nothing about word, sorry ...   up points to 500 and see .. you might get a bite :)
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17772473
hay kinger, i'm gone a lot deeper in this matter and lost my mind.... check out my question
no one .. I MEAN IT.. no one were replied in POLISHED manner...
can u help me in postin ptr que.. i'm not able to do it ..... as i dont have even 20 points,,,,,
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 17772489
Autoeforms , sorry if u find us bad mannerd guyz but still
download this SAMPLES and try to learn...

http://www.activexperts.com/activmonitor/windowsmanagement/wmi/samples/
0
 
LVL 8

Author Comment

by:Autoeforms
ID: 17772835
i take no offense at any of your comments.

and yes all of the pieces are there.  but to be honest i would expect MS to provide a better object for this solution.  there are to many programmers constently re-inventing the wheel. Think what you happen if eveyone needed to build a file dialog box.

For example. you would think MS would have a class or function call that returns the windows version without parsing release numbers.  Can it be done yes. Should everyone in the world need to do it no.

As far as the example it is great and as i said i had already found it. You know i could not find a listing of the property strings any where (e.g. "version"). Which makes me wonder what other info is available.  It is one thing to take a code snippit and make it work. It is quite another to wonder if you have the best solution or you are using the pieces as they were intended.

There is more then enough business logic to keep developers busy for a life time. This kind of stuff should be a slam dunk.

thanks for your opions

g
















0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17772847
I agree :)
make our lives alot easier.
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 17772891
well ur right autoeforms,
now here comes some more places of ur interest... i'm sorry i cnt help u my trying my self...
http://www.codeproject.com/cs/internet/remotesysinformation.asp

dont prefer this... as in vc
http://www.codeproject.com/system/computerinfo.asp
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17803974
Hi Autoeforms,

check this namespace My.Computer.Info.....  loads of stuff there you could use !

cheers.
0
 
LVL 8

Author Comment

by:Autoeforms
ID: 17804106
thanks that is one i haven't seen
unfortunately still returning winnt as the os
still haven't found exactly what i am looking for so it looks like it is going to be a development project to get what i need
alas
g
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now