Link to home
Start Free TrialLog in
Avatar of heng03
heng03

asked on

System info & Hardware Devices

Hi

I want to know, using VB, how to get below system info. & hardware device of each indivdual computer.

1) OS
    eg,  Microsoft Windows

2) Processor
    eg, x86 Family 6 Model 11 Stepping 1
          Speed: 1196 Mhz

3) Memory
     eg,  256 MB Chip

4) Drive Information
    eg, GENERIC IDE  DISK TYPE47 - 18.63 GB

5)  Adapter
     eg,
     Realtek 8139-series PCI NIC                                                      
     Mac: 00:50:EB:08:86:B8

     PPP Adapter.
     Mac: 44:45:53:54:00:00


     No MAC Address

6)  HDD Partition info
     eg, Drive ID etc

7)  FDD Info (Drive ID)

8)  Sound Card info

9)  CD card Info

10) Display Video card info

11) others Hardward devices info
      eg,
      Keyboard, mouse, USB ports,  COM Ports, Parallel port (Printer) etc


Thanks & Rgs
Heng


Avatar of heng03
heng03

ASKER

Hi

Only answer meet with most of the requirements will get the points.
Else I will post another question for less points of the answer.

Thanks & Rgds
Heng
Go here and Download System Scripting Runtime 1.4 (if you havent already got it)

http://www.netal.com/download.htm

and use this VBScript...

Option Explicit

On Error Resume Next

Dim objIPNetwork
Dim objLMNetwork
Dim objSystem
Dim strSystemInfo
Dim strProductType

'Clear any previous errors
Err.Clear

'Create object reference for the ping operation
Set objIPNetwork = CreateObject("SScripting.IPNetwork")

'Create object reference for the ping operation
Set objLMNetwork = CreateObject("SScripting.LMNetwork")

'Create object reference for the ping operation
Set objSystem = CreateObject("SScripting.System")

If Err.Number <> 0 Then
  Wscript.Echo "An error occurred creating an object reference." & _
              vbCrLf & "Please register the SScrRun.dll file."
  Wscript.Quit
End If

'Determine the operating system product type
Select Case objSystem.ProductType
    Case -1 : strProductType = "unknown"
    Case 0 : strProductType = "workstation"
    Case 1 : strProductType = "server"
    Case 2 : strProductType = "domain controller"
End Select

strSystemInfo = "------------------------------------------" & vbCrLf & _
            "System Information" & vbCrLf & _
            "------------------------------------------" & vbCrLf & _
            "Computer Name: " & objLMNetwork.ComputerName & vbCrLf & _
            "Host Name: " & objIPNetwork.HostName & vbCrLf & _
            "DNS Domain Name: " & objIPNetwork.Domain & vbCrLf & _
            "Current Directory: " & objSystem.CurrentDirectory & vbCrLf & _
            "System Directory: " & objSystem.SystemDirectory & vbCrLf & _
            "Windows Directory: " & objSystem.WindowsDirectory & vbCrLf & _
            "Temp Path: " & objSystem.TempPath & vbCrLf & _
            "Operating System: " & objSystem.OperatingSystem & vbCrLf & _
            "Processor Count: " & objSystem.ProcessorCount & vbCrLf & _
            "Processor Description: " & objSystem.ProcessorDescription & vbCrLf & _
            "Product Type: " & strProductType & vbCrLf & _
            "User Name: " & objSystem.UserName & vbCrLf & _
            "Total Memory: " & objSystem.TotalMemory & "MB" & vbCrLf & _
            "Local Time: " & objSystem.GetLocalTime() & vbCrLf & _
            "System Time: " & objSystem.GetSystemTime() & vbCrLf & _
            "------------------------------------------"

'Display letter, type, total space and free space about every available Drive

Dim strDriveInfo, strDrive, intDriveType, intCounter, strDriveType
Dim strTDiskSpace, strFDiskSpace

strDriveInfo = "Drive Information" & vbCrLf & _
               "------------------------------------------"
'Loop through 26 possible drive letters
For intCounter = 0 to 25
    strDrive = chr( 65 + intCounter ) & ":"
    intDriveType = objSystem.GetDriveType( strDrive )
    If intDriveType <> 1 Then
        'Drive exists
        'Determine drive type
        Select Case intDriveType
            Case 0 'The drive type cannot be determined.
                strDriveType = "unknown"
            Case 1 'The specified drive does not exist.
                strDriveType = "does not exist"
            Case 2 'The disk can be removed from the drive.
                strDriveType = "removable"
            Case 3 'The disk cannot be removed from the drive.
                strDriveType = "fixed"
            Case 4 'The drive is a remote (network) drive.
                strDriveType = "network"
            Case 5 'The drive is a CD-ROM drive.
                strDriveType = "cd-rom"
            Case 6 'The drive is a RAM disk.
                strDriveType = "ram disk"
        End Select

        'Add appropriate info about drive depending on media availability.
        If objSystem.GetTotalDiskSpace( strDrive ) > 0 Then
            strTDiskSpace = CStr(objSystem.GetTotalDiskSpace( strDrive )) & " KB"
            strFDiskSpace = CStr(objSystem.GetFreeDiskSpace( strDrive )) & " KB"
        Else
            strTDiskSpace = "No media"
            strFDiskSpace = "N/A"
        End If
        strDriveInfo = strDriveInfo & vbCrLf & _
        "Drive " & strDrive & _
        ",  Type: " & strDriveType & _
        ",  TotalDiskSpace: " & strTDiskSpace & _
        ",  FreeDiskSpace: " & strFDiskSpace
    End If
Next

'Display system info message
WScript.Echo strSystemInfo & vbCrLf & strDriveInfo

'Release object references
Set objIPNetwork = Nothing

Set objLMNetwork = Nothing

Set objSystem = Nothing
gSet objSystem = Nothing






I am working on the rest of the info you need...
Avatar of heng03

ASKER

Hi rhys

Waiting for the rest of your information.

Will give you extra 50 points (total 250) for the rest of the information.

Do you also know any example source code for using WMI ?
I installed WMI but where to check it ?

Thanks & Rgds
Heng

Avatar of heng03

ASKER

Hi rhys

Waiting for the rest of your information.

Will give you extra 50 points (total 250) for the rest of the information.

Do you also know any example source code for using WMI ?
I installed WMI but where to check it ?

Thanks & Rgds
Heng

ASKER CERTIFIED SOLUTION
Avatar of rhys_kirk
rhys_kirk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yet another example of using WMI (this time with VB.Net)....

I've got an application called SOSOS that will gather 150+ pieces of information from a PC and store the results in a central database.  It's useful for putting in a login batch... or can be remotely over the network by an Administrator.

Full source code is at ftp://ftp.dpw.hood.army.mil/programs/sosos
Avatar of heng03

ASKER

Hi rhys

Thanks for your help. It is useful.

Also thanks to Graye.
Note : For Graye : I will create another Question & will allocate points to you for your help too.
                             Pls answer that question (answer dummy as your answer is here already).

Graye : Sorry for the trouble as here it is not allow to split (allocate) points to more than one experts in
a question's answer.

Thanks & Rgds
Heng
relax... this is not a competition with me.   There's no need to do anything get me more points!

I'm just trying to help folks out
Avatar of heng03

ASKER

Hi Graye

Thanks anyway.
I already posted a question for you.

Hope to see you there for it.

Rgds
Heng