Sign in to follow this  
Followers 0
ksmith247

Pull WMI from multiple classes

4 posts in this topic

I am gathering data from WMI on a remote machine and displaying it in a msgbox. The only way I know how to display the data is one class at a time in its own msgbox. I would like to gather all of the data first then display it all in a single msgbox. Can someone please point me in the right direction?

Thanks

Case $msg = $Button_13
$ReadInput = GUICtrlRead($Input_1)

$objWMIService = ObjGet("winmgmts:\\" & $ReadInput & "\root\CIMV2")

$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Bios")
                    
    For $objItem In $colItems
        MsgBox(4096, "BIOS Info for " & $ReadInput, "Serial Number: " & $objItem.SerialNumber & @CRLF & _
    "Manufacturer: " & $objItem.Manufacturer & @CRLF & _
    "BIOS Name: " & $objItem.Name)
    Next
            
$colItems2 = $objWMIService.ExecQuery ("SELECT * FROM Win32_ComputerSystem")
    For $objItem In $colItems2
        MsgBox(4096, "System Info for " & $ReadInput, "Model: " & $objItem.Model & @CRLF _
        & "Last User: " & $objItem.UserName)
    Next

Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Share this post


Link to post
Share on other sites



Case $msg = $Button_13
$ReadInput = GUICtrlRead($Input_1)

$objWMIService = ObjGet("winmgmts:\\" & $ReadInput & "\root\CIMV2")

$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Bios")

$message = "BIOS Info for " & $ReadInput & @CRLF & "-------" & @CRLF & @CRLF

    For $objItem In $colItems
        $message &= "Serial Number: " & $objItem.SerialNumber & @CRLF & _
    "Manufacturer: " & $objItem.Manufacturer & @CRLF & _
    "BIOS Name: " & $objItem.Name & @CRLF & @CRLF
    
;~         MsgBox(4096, "BIOS Info for " & $ReadInput, "Serial Number: " & $objItem.SerialNumber & @CRLF & _
;~     "Manufacturer: " & $objItem.Manufacturer & @CRLF & _
;~     "BIOS Name: " & $objItem.Name)
    Next
    
$message &= "System Info for " & $ReadInput & @CRLF & "-------" & @CRLF & @CRLF
            
$colItems2 = $objWMIService.ExecQuery ("SELECT * FROM Win32_ComputerSystem")
    For $objItem In $colItems2
        $message &= "Model: " & $objItem.Model & @CRLF _
        & "Last User: " & $objItem.UserName  & @CRLF & @CRLF
        
;~         MsgBox(4096, "System Info for " & $ReadInput, "Model: " & $objItem.Model & @CRLF _
;~         & "Last User: " & $objItem.UserName)
    Next
 
  MsgBox(4096, "BIOS and System Info for " & $ReadInput, $message)

But such kind of data is better to place into some ListView, one for Bios, one for System data

Share this post


Link to post
Share on other sites

Thank you. Now you bring up two new questions.

1. I assume this work because you are defining $message as several things. Is there a limit on how many times this can happen?

2. I am confused, what do you mean by ListView?


Support bacteria; it's the only culture most people have.LxP's Learning to Script with AutoIt 3 - Excellent starting placeVolly's Links Page - Links to cool and useful scriptsAutoIt Wrappers - Valuater's AutoIt Wrappers post. Lots of good stuff.Support AutoIt - Make a donation here; I did.[size="2"]#include <Guinness.pint>[/size]

Share this post


Link to post
Share on other sites

Thank you. Now you bring up two new questions.

1. I assume this work because you are defining $message as several things. Is there a limit on how many times this can happen?

2. I am confused, what do you mean by ListView?

1) There is no limit for number of iterations as far as I know but your MessageBox will not fit on the screen

2) Look into Autoit helpfile at GUICtrlCreateListView() - there is nice example

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0