• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3143
  • Last Modified:

MSINFO32 to query multiple systems

I am wanting a batch file or script that i can use to poll multiple systems for thier hardware and network config and output that into a report.

this will return the required information for 1 system

msinfo32 /computer <<computer name>> /categories +componentsnetwork /report c:\msinfo\report.txt

 but i an needing to poll about 500 systems, is there a way to point the "/computer <computer name>" at a text file with a list of names then output that into individual files .txt or .csv
0
katacombz
Asked:
katacombz
  • 3
1 Solution
 
jculkincysCommented:
I know this isn't exactly what you are looking for but I think It may get you on the right path
The below example shows the results in a message box but I am sure you could put them in a text file rather easily


This is a link to the windows scripting center

http://www.microsoft.com/technet/scriptcenter/default.mspx


Save this code into a .vbs file and it ping the machines in the list
******
strMachines = "10.1.1.67;10.1.1.53;10.1.1.55;10.1.1.2"
aMachines = split(strMachines, ";")
 
For Each machine in aMachines
    Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
        ExecQuery("select * from Win32_PingStatus where address = '"_
            & machine & "'")
    For Each objStatus in objPing
        If IsNull(objStatus.StatusCode) or objStatus.StatusCode<>0 Then
            WScript.Echo("Computer " & machine & " is not reachable")
        End If
    Next
Next

****
0
 
katacombzAuthor Commented:
No I am needing to query by name, I am needing to pull info from specific systems. trying to poll the servers only not all the desktops (1k+)

bit i think I have it all sorted after workign with one of our DB admin
strFilePath = "c:\msinfo\serverlist.txt"

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objtextFile = objFSO.OpenTextFile (strFilePath, 1)

Do Until objtextFile.AtEndOfStream

strComputer = Trim(objtextFile.ReadLine)


On Error Resume Next

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objItem in colItems
   
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "Domain: " & objItem.Domain
    Wscript.Echo "Manufacturer: " & objItem.Manufacturer
    Wscript.Echo "Model: " & objItem.Model  
    Wscript.Echo "NumberOfProcessors: " & objItem.NumberOfProcessors
    Wscript.Echo "TotalPhysicalMemory: " & objItem.TotalPhysicalMemory
   
Next

On Error Resume Next

Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colSWbemObjectSet = _
 objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

For Each objSWbemObject In colSWbemObjectSet
 Wscript.Echo "Total Physical Memory (kb): " & _
 objSWbemObject.TotalPhysicalMemory
Next

On Error Resume Next

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
For Each objItem in colItems
    Wscript.Echo "Name: " & objItem.Name
   Next



Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set IPConfigSet = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")
 
For Each IPConfig in IPConfigSet
    If Not IsNull(IPConfig.IPAddress) Then
        For i=LBound(IPConfig.IPAddress) to UBound(IPConfig.IPAddress)
            WScript.Echo IPConfig.IPAddress(i)
        Next
    End If
Next

On Error Resume Next
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive",,48)
For Each objItem in colItems
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Manufacturer: " & objItem.Manufacturer
    Wscript.Echo "Model: " & objItem.Model
    Wscript.Echo "Size: " & objItem.Size
   
   
Next

On Error Resume Next

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_IP4RouteTable",,48)
For Each objItem in colItems
    Wscript.Echo "Age: " & objItem.Age
    Wscript.Echo "Caption: " & objItem.Caption
    Wscript.Echo "Description: " & objItem.Description
    Wscript.Echo "Destination: " & objItem.Destination
    Wscript.Echo "Information: " & objItem.Information
    Wscript.Echo "InstallDate: " & objItem.InstallDate
    Wscript.Echo "InterfaceIndex: " & objItem.InterfaceIndex
    Wscript.Echo "Mask: " & objItem.Mask
    Wscript.Echo "Metric1: " & objItem.Metric1
    Wscript.Echo "Metric2: " & objItem.Metric2
    Wscript.Echo "Metric3: " & objItem.Metric3
    Wscript.Echo "Metric4: " & objItem.Metric4
    Wscript.Echo "Metric5: " & objItem.Metric5
    Wscript.Echo "Name: " & objItem.Name
    Wscript.Echo "NextHop: " & objItem.NextHop
    Wscript.Echo "Protocol: " & objItem.Protocol
    Wscript.Echo "Status: " & objItem.Status
    Wscript.Echo "Type: " & objItem.Type

Next



Set objSWbemServices = GetObject("winmgmts:\\" & strComputer)
Set colSWbemObjectSet = _
 objSWbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")

For Each objSWbemObject In colSWbemObjectSet
 Wscript.Echo "Total Virtual Memory (kb): " & _
 objSWbemObject.TotalVirtualMemory
Next
loop
objTextFile.close

0
 
katacombzAuthor Commented:
Oh and I am kicking thsi off with a batch file

c:
cd c:\msinfo
cls
cscript testscript.vbs >c:\msinfo\testscript.csv


0
 
katacombzAuthor Commented:
I think I provided a solution to the question
0
 
moduloCommented:
PAQed with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now