Click here to Skip to main content
15,902,275 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionGetting all availabel information of a computer? Pin
dungle304-Oct-04 0:18
dungle304-Oct-04 0:18 
AnswerRe: Getting all availabel information of a computer? Pin
Dave Kreskowiak4-Oct-04 5:45
mveDave Kreskowiak4-Oct-04 5:45 
GeneralRe: Getting all availabel information of a computer? Pin
dungle305-Oct-04 22:10
dungle305-Oct-04 22:10 
GeneralRe: Getting all availabel information of a computer? Pin
Dave Kreskowiak6-Oct-04 13:13
mveDave Kreskowiak6-Oct-04 13:13 
GeneralRe: Getting all availabel information of a computer? Pin
dungle306-Oct-04 16:38
dungle306-Oct-04 16:38 
GeneralRe: Getting all availabel information of a computer? Pin
Dave Kreskowiak6-Oct-04 17:03
mveDave Kreskowiak6-Oct-04 17:03 
GeneralRe: Getting all availabel information of a computer? Pin
dungle307-Oct-04 18:27
dungle307-Oct-04 18:27 
GeneralRe: Getting all availabel information of a computer? Pin
Dave Kreskowiak8-Oct-04 4:30
mveDave Kreskowiak8-Oct-04 4:30 
Actually, I'm working on such a solution now. The code is pretty ruff, but it gets the point acrossed. In order to see the SWbem* classes, you'll need to add a Reference to the Microsoft WMI Scripting Library.
Dim wmiLocator As New SWbemLocator
Dim wmiService As SWbemServices
Dim wmiObjectSet As SWbemObjectSet
Dim wmiObject As SWbemObject
Dim intIndex As Long

    On Error Resume Next
    Set wmiService = wmiLocator.ConnectServer(strNameOrAddress, "root\CIMV2")
    If Err.Number = 0 Then
        Set wmiObjectSet = wmiService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
        For Each wmiObject In wmiObjectSet
            With objWMIDataBlock
                .strMachineName = Trim(wmiObject.Properties_("Name"))
                .strDomain = Trim(wmiObject.Properties_("Domain"))
                .strManufacturer = Trim(wmiObject.Properties_("Manufacturer"))
                .strModel = Trim(wmiObject.Properties_("Model"))
                .intRAMSize = Round((wmiObject.Properties_("TotalPhysicalMemory") \ 1048576) / 32, 0) * 32
            End With
        Next
        
        Set wmiObjectSet = wmiService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
        For Each wmiObject In wmiObjectSet
            With objWMIDataBlock
                .strOSName = Trim(wmiObject.Properties_("Caption"))
                .strOSServicePack = Trim(wmiObject.Properties_("CSDVersion"))
                .strOSVersion = Trim(wmiObject.Properties_("Version"))
            End With
        Next
        
        Set wmiObjectSet = wmiService.ExecQuery("SELECT * FROM Win32_BIOS")
        For Each wmiObject In wmiObjectSet
            With objWMIDataBlock
                .strBIOSManufacturer = Trim(wmiObject.Properties_("Version"))
                .strBIOSVersion = Trim(wmiObject.Properties_("SMBIOSMajorVersion")) & _
                                "." & Trim(wmiObject.Properties_("SMBIOSMinorVersion"))
                .strBIOSRevision = Trim(wmiObject.Properties_("SMBIOSBIOSVersion"))
                .strSerialNumber = Trim(wmiObject.Properties_("SerialNumber"))
            End With
        Next
        
        Set wmiObjectSet = wmiService.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE AdapterType='Ethernet 802.3'")
        ReDim objWMIDataBlock.arrNICs(wmiObjectSet.Count - 1)
        objWMIDataBlock.NICCount = wmiObjectSet.Count
        intIndex = 0
        For Each wmiObject In wmiObjectSet
            With objWMIDataBlock.arrNICs(intIndex)
                .strMAC = MACCleanup(wmiObject.Properties_("MACAddress"))
                .strDescription = Trim(wmiObject.Properties_("Caption"))
            End With
            intIndex = intIndex + 1
        Next
        
        Set wmiObjectSet = wmiService.ExecQuery("SELECT * FROM Win32_QuickFixEngineering")
        intIndex = 0
        For Each wmiObject In wmiObjectSet
            If Left(wmiObject.Properties_("HotFixID"), 4) <> "File" Then
                ReDim Preserve objWMIDataBlock.arrHotFixes(intIndex)
                With objWMIDataBlock.arrHotFixes(intIndex)
                    .strHoxFixID = Trim(wmiObject.Properties_("HotFixID"))
                    .strDescription = Trim(wmiObject.Properties_("Description"))
                End With
                intIndex = intIndex + 1
            End If
        Next
        objWMIDataBlock.HotFixCount = intIndex
    Else
        objWMIDataBlock.strMachineName = strNameOrAddress
        status strNameOrAddress & " is alive but WMI Service could not be reached."
        LogError strNameOrAddress, "", Err.Number, Err.Description
    End If
    On Error GoTo 0



RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralRe: Getting all availabel information of a computer? Pin
dungle3010-Oct-04 19:12
dungle3010-Oct-04 19:12 
AnswerRe: Getting all availabel information of a computer? Pin
Anonymous4-Oct-04 22:23
Anonymous4-Oct-04 22:23 
GeneralReturn the value of cancel button Pin
Mekong River3-Oct-04 21:57
Mekong River3-Oct-04 21:57 
GeneralRe: Return the value of cancel button Pin
Syed Abdul Khader3-Oct-04 23:11
Syed Abdul Khader3-Oct-04 23:11 
GeneralRe: Return the value of cancel button Pin
Mekong River3-Oct-04 23:17
Mekong River3-Oct-04 23:17 
GeneralRe: Return the value of cancel button Pin
Desi Bravo5-Oct-04 3:51
Desi Bravo5-Oct-04 3:51 
QuestionHow to create COM objects in VB.NET Pin
MohammadAmiry3-Oct-04 21:30
MohammadAmiry3-Oct-04 21:30 
AnswerRe: How to create COM objects in VB.NET Pin
Dave Kreskowiak4-Oct-04 5:43
mveDave Kreskowiak4-Oct-04 5:43 
QuestionHow to make a spread sheet application using c++? Pin
M Astrid3-Oct-04 20:29
M Astrid3-Oct-04 20:29 
AnswerRe: How to make a spread sheet application using c++? Pin
Colin Angus Mackay3-Oct-04 23:29
Colin Angus Mackay3-Oct-04 23:29 
GeneralHi Help Me I Want Write VBScript Of (&quot;Outlook.Application&quot;) Pin
webhot3-Oct-04 20:07
webhot3-Oct-04 20:07 
GeneralRe: Hi Help Me I Want Write VBScript Of (&quot;Outlook.Application&quot;) Pin
Dave Kreskowiak4-Oct-04 5:28
mveDave Kreskowiak4-Oct-04 5:28 
GeneralSpeed Dialer using VB 6.0 Pin
wlho3-Oct-04 16:51
wlho3-Oct-04 16:51 
GeneralRe: Speed Dialer using VB 6.0 Pin
Dave Kreskowiak4-Oct-04 8:48
mveDave Kreskowiak4-Oct-04 8:48 
Questionhow to refresh datagrid?? Pin
Lisana3-Oct-04 15:44
Lisana3-Oct-04 15:44 
AnswerRe: how to refresh datagrid?? Pin
Syed Abdul Khader3-Oct-04 23:39
Syed Abdul Khader3-Oct-04 23:39 
GeneralRe: how to refresh datagrid?? Pin
Anonymous4-Oct-04 4:08
Anonymous4-Oct-04 4:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.