none
Need all computer information in exel format

    Domanda

  • Hi

    I need to gather basic  information from all desktops/laptops on our domain in specific format.

    VB Script preferable

    Input file - desktop.cvs where need to mentioned all desktop hostname or IP

    and  out file - output.cvs which should have specific colom with information of all computers.

    example :

    Computer name , ip ,OS ,Version ,IE VERSION, SERVICEPACK, SOFTWARES INSTALLED

    Please help me to provide this custmised script.

    giovedì 22 marzo 2012 16:26

Risposte

Tutte le risposte

  • Hi

    I need to gather basic  information from all desktops/laptops on our domain in specific format.

    VB Script preferable

    Input file - desktop.cvs where need to mentioned all desktop hostname or IP

    and  out file - output.cvs which should have specific colom with information of all computers.

    example :

    Computer name , ip ,OS ,Version ,IE VERSION, SERVICEPACK, SOFTWARES INSTALLED

    Please help me to provide this custmised script.

    There is no such format as CVS. CVS is a retail pharmacy chain.

    If you mean you want this in CSV format then you also need to know that that is no Excel.  It just opens by default in Excel IF Excel is installed.

    Look int the repository.  There are many computer inventory scripts that do what you are asking.


    ¯\_(ツ)_/¯

    giovedì 22 marzo 2012 16:44
  • Hi

    there isn't an easy way to do what your asking in a script. The OS, version, and service pack are pretty simple they're just LDAP requests. You should be able to get the installed software form enumerating the all the names in the  HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

    However if you;ve got a reasonably sized estate you're probalby best off investing in a discovery tool.

    Cheers

    Alex

    giovedì 22 marzo 2012 16:48
  • Sorry miss typed.

    I have gone through many scripts but not getting what I need.

    can you please help to set this up ?

    just need  that mentioned five parameters in output excel format.

    computer name , IP , OS ,OS VERSION ,Service pack ,IE VERSION , SOFTWARES

    All compters data should be in single outputl file.

    Thanks

    Mangesh

    giovedì 22 marzo 2012 16:50
  • You can use this example to document all computers in a spreadsheet:

    http://www.rlmueller.net/Inventory.htm

    You can modify the base of the ADO query (the value assigned to the variable strRootDomain) to be the distinguished name of an OU. Or, you could modify the scirpt to read computer names from a csv file, using the FileSystemObject. You would replace the code that uses ADO to query for all computers with something similar to below:

    Const ForReading = 1

    ' Open the csv file.
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("c:\Scripts\Computers.csv", ForReading)

    ' Read each line of the file.
    Do Until objFile.AtEndOfStream
        strComputer = Trim(objFile.ReadLine)
        ' Do something for every computer name in the file.
    Loop

    ' Clean up.
    objFile.Close

    -----

    There are several methods to enumerate all software installed on a computer. Others in this thread have suggested methods. You can also find more in the Script Gallery


    Richard Mueller - MVP Directory Services

    giovedì 22 marzo 2012 17:09
    Moderatore
  • Here is a very good way to get almost everything.

    function Get-PCInfo{
         Param(
           [Parameter(ValueFromPipeline=$true)]
           $computername=$env:computername
         )
         $OSInfo=gwmi win32_operatingsystem -computer $computername|select __SERVER, caption,version,CSDVersion 
         $IEVersion=(gwmi  -name root\CimV2\Applications\MicrosoftIE -class MicrosoftIE_Summary -computername $computername).Version
         $OSInfo | Add-Member -membertype NoteProperty -name IEVersion -value $IEVersion -passthru
    }
    Cat servers.txt | Get-PCInfo | Export-Csv SysInfo.csv -notype

    It is easist in PowerShell.

    Getting a list of products can be done also very easily but you cannot include it in your Excel sheet.  It is an issue of computer data relations.

    Windows technicians understand the relational nature of computer information.  What you are asking bviolate the principals of data normalization.  To overcome this we need two spreadsheets.  This is anissue that non-technical people usually cannot understand and I am assuing that is why you are asking for the installed software on the same line as the OS info.

    cat servers.txt | %{gwmi win32_product -computer ws101|select __Server, Caption, Version } |Export products.csv -notype

    You will see that for each server there may be hundreds of software products installed.


    ¯\_(ツ)_/¯

    giovedì 22 marzo 2012 23:56
  • Hi

    Can somenehelp me to add to edit this script as per my requirement?

    I need to add input file as text file where I can give multiple compter names and get the output insame format but need to add moreColom  info like,

    computer name ,IP, OS Version,Servicepack,IE Version

    -----------------------------------------------

    ' Declare Variables 
    Dim dTtle 
    dTtle = "Enumerate Software" 
    Dim dHost 
    'Provide prompt to specify audit system 
    dHost = InputBox("Enter the I.P. or the computer " & _ 
                           "you would like to check the installed software " & _ 
                           "on." & vbcrlf & vbcrlf & "Remote enumeration " & _ 
                           "will be performed in the context of the current " & _ 
                           "logged on user", dTtle) 
                            
    If IsEmpty(dHost) Then WScript.Quit 
    dHost = Trim(dHost) 
    If dHost = "" Then dHost = "." 
                         
    'Provide prompt to specify save location & further declaration 
    Dim dFdl 
    dFdl = InputBox("Enter the pathname to output the details of this audit " , dTtle) 
    Dim dFle 
    dFle = dFdl & dHost & ".xls" 
      
    If IsEmpty(dFdl) Then WScript.Quit 
     
    'Create & launch Excel workbook    
    Set objExcel = CreateObject("Excel.Application"
    objExcel.Visible = True 
    Set objWorkbook = objExcel.Workbooks.Add() 
    Set objWorksheet = objWorkbook.Worksheets(1
    x = 2 
     
    objExcel.Cells(11).Value = "Name" 
    objExcel.Cells(12).Value = "Vendor" 
    objExcel.Cells(13).Value = "Version" 
    objExcel.Cells(14).Value = "InstallLocation" 
    objExcel.Cells(15).Value = "Description" 
     
    'Access the required WMI namespace to perform query 
    Set objWMIService = _ 
        GetObject("winmgmts:\\" & dHost & "\root\cimv2"
    Set colItems = objWMIService.ExecQuery _ 
        ("Select * from Win32_Product"
    'Perform FOR EACH loop and update newly created spreadsheet 
    For Each objItem in colItems 
        objWorksheet.Cells(x, 1) = objItem.Name 
        objWorksheet.Cells(x, 2) = objItem.Vendor 
        objWorksheet.Cells(x, 3) = objItem.Version  
        objWorksheet.Cells(x, 4) = objItem.InstallLocation 
        objWorksheet.Cells(x, 5) = objItem.Description     
        x = x + 1 
    Next 
     
    Set objRange = objWorksheet.UsedRange 
    objRange.EntireColumn.Autofit() 
     
    'Save & close updated spreadsheet. 
    objExcel.ActiveWorkbook.SaveAs dFle 
    objExcel.ActiveWorkbook.Close 
    objExcel.Application.Quit 
     
    WScript.Echo "Software Enumeration Complete." 
    WScript.Quit 

    ------------------------------------------------------------

    sabato 24 marzo 2012 08:49
  • Look into the FileScriptingObject for getting input from a file.

    Here is a template for reading input from a text file:

    http://gallery.technet.microsoft.com/scriptcenter/How-to-read-lines-from-a-949932b6


    ¯\_(ツ)_/¯

    sabato 24 marzo 2012 10:51
  • Hi

    This script is givening all information what we required but it isjust giveing output as on single test file.

    For below script please suggest :

    -Input text file so we can give as many as computer IP /hostname for audit

    -Output should be in proper excel format computer name wise

    Please provide your valuable inputs.

    -----------------------------------------------------

    On Error Resume Next
     
    Const HKEY_LOCAL_MACHINE = &H80000002
     
    'change this value to the IP address or hostname of the machine you need to audit
    Dim strIPvalue
     
    strIPvalue = InputBox("192.168.1.141")
     
    CALL GenerateReport(strIPvalue)
     
     
     
     
    '=================================================================================
    'SUB-ROUTINE GenerateReport
    SUB GenerateReport(strIPvalue)
     
    'Script to change a filename using timestamps
    strPath = "C:\testing"
    strMonth = DatePart("m", Now())
    strDay = DatePart("d",Now())
     
    if Len(strMonth)=1 then
    strMonth = "0" & strMonth
    else
    strMonth = strMonth
    end if
     
     
    if Len(strDay)=1 then
    strDay = "0" & strDay
    else
    strDay = strDay
    end if
     
     
    strFileName = DatePart("yyyy",Now()) & strMonth & strDay
    strFileName = Replace(strFileName,":","")
    '=================================================================================
     
    'Variable Declarations
    Const ForAppending = 8
     
    '===============================================================================
    'Main Body
    On Error Resume Next
     
     
    'CompName
     
    strComputer =strIPvalue
     
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
     
     
    '===============================================================================
     
    '================================================================
    'For INTERNET EXPLORER
    Dim strIE
    Set objWMIService2 = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2\Applications\MicrosoftIE")
    Set colIESettings = objWMIService2.ExecQuery("Select * from MicrosoftIE_Summary")
    For Each strIESetting in colIESettings
    strIE= " INTERNET EXPLORER: " & strIESetting.Name & " v" & strIESetting.Version & VBCRLF
    Next
     
     
    'Get Operation System & Processor Information
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
    For Each objItem in colItems
    CompName = objItem.SystemName
    Next
     
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    if objFSO.FileExists(strPath & strComputer & "_Audit.txt") then
    WScript.Quit
    end if
     
    'Set the file location to collect the data
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile(strPath & CompName & "_Audit.txt", ForAppending, True)
     
     
    ''==============================================================
    'Print HEADER
    objTextFile.Write "================================================================" & VBCRLF & VBCRLF
    objTextFile.Write " SERVER RESOURCE AUDIT REPORT " & VBCRLF
    objTextFile.Write " DATE: " & FormatDateTime(Now(),1) & " " & VBCRLF
    objTextFile.Write " TIME: " & FormatDateTime(Now(),3) & " " & VBCRLF & VBCRLF
    objTextFile.Write "================================================================" & VBCRLF & VBCRLF & VBCRLF & VBCRLF & VBCRLF
     
     
    objTextFile.Write "COMPUTER" & VBCRLF
    '==============================================================
    'Get OPERATING SYSTEM & Processor Information
    objTextFile.Write " COMPUTER NAME: " & CompName & VBCRLF
     
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor",,48)
    For Each objItem in colItems
    objTextFile.Write " PROCESSOR: " & objItem.Name & VBCRLF
    Next
     
    Set colProcs = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
     
    For Each objItem in colProcs
    objTextFile.Write " NUMBER OF PROCESSORS: " & objItem.NumberOfProcessors & VBCRLF & VBCRLF
    Next
    '---------------------------------------------------------------------------------------------------------------------------------------
    'For Logged on user
    Set colComputer = objWMIService.ExecQuery _
        ("Select * from Win32_ComputerSystem")
     
    For Each objComputer in colComputer
        objTextFile.Write "Logged-on user: " & objComputer.UserName & VBCRLF
    Next
     
    '================================================================
    'Get DOMAIN NAME information
    Set colItems = objWMIService.ExecQuery("Select * from Win32_NTDomain")
     
    For Each objItem in colItems
    objTextFile.Write " DOMAIN NAME: " & objItem.DomainName & vbCrLf & VBCRLF
    Next
     
    '================================================================
    'Get OS Information
    Set colSettings = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
    For Each objOperatingSystem in colSettings
    objTextFile.Write " OPERATING SYSTEM: " & objOperatingSystem.Name & VBCRLF
    objTextFile.Write " VERSION: " & objOperatingSystem.Version & VBCRLF
    objTextFile.Write " SERVICE PACK: " & objOperatingSystem.ServicePackMajorVersion & "." & objOperatingSystem.ServicePackMinorVersion & VBCRLF
    Next
    objTextFile.Write strIE & VBCRLF & VBCRLF & VBCRLF & VBCRLF
     
     
     
     
     
    objTextFile.Write "MOTHERBOARD" & VBCRLF 
     
    '===============================================================
    'Get Main Board Information
    Set colItems = objWMIService.ExecQuery("Select * from Win32_BaseBoard",,48)
    For Each objItem in colItems
    objTextFile.Write " MAINBOARD MANUFACTURER: " & objItem.Manufacturer & VBCRLF
    objTextFile.Write " MAINBOARD PRODUCT: " & objItem.Product & VBCRLF
    Next
     
     
     
    '================================================================
    'Get BIOS Information
    Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
    For Each objItem in colItems
    objTextFile.Write " BIOS MANUFACTURER: " & objItem.Manufacturer & VBCRLF
    objTextFile.Write " BIOS VERSION: " & objItem.Version & VBCRLF & VBCRLF & VBCRLF & VBCRLF & VBCRLF
    Next
     
    objTextFile.Write "MEMORY" & VBCRLF 
     
    '===================================================================
    'Get Total Physical memory
    Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
    For Each objComputer in colSettings
    objTextFile.Write " TOTAL PHYSICAL RAM: " & Round((objComputer.TotalPhysicalMemory/1000000000),4) & " GB" & VBCRLF
    Next
     
    objTextFile.Write " " & VBCRLF & VBCRLF & VBCRLF & VBCRLF & "PARTITIONS" & VBCRLF 
     
    '===================================================================
    'Get Logical Disk Size and Partition Information
    Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = 3")
    For Each objDisk in colDisks
    intFreeSpace = objDisk.FreeSpace
    intTotalSpace = objDisk.Size
    pctFreeSpace = intFreeSpace / intTotalSpace
    objTextFile.Write " DISK " & objDisk.DeviceID & " (" & objDisk.FileSystem & ") " & Round((objDisk.Size/1000000000),4) & " GB ("& Round((intFreeSpace/1000000000)*1.024,4) & " GB Free Space)" & VBCRLF
    Next
     
    objTextFile.Write " " & VBCRLF & VBCRLF & VBCRLF & VBCRLF & "NETWORK" & VBCRLF 
     
    '====================================================================
    'Get NETWORK ADAPTERS information
    Dim strIP, strSubnet, strDescription
     
    Set colNicConfigs = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")
     
    For Each objNicConfig In colNicConfigs
    'Assign description values to variable
    strDescription=objNicConfig.Description
     
    For Each strIPAddress In objNicConfig.IPAddress
    'Assign IP Address to variable
    strIP=strIPAddress 
     
    For Each strIPSubnet In objNicConfig.IPSubnet
    'Assign Subnet to variable
    strSubnet = strIPSubnet
    Next
     
    objTextFile.Write " NETWORK ADAPTER: " & strDescription & VBCRLF
    objTextFile.Write " IP ADDRESS: " & strIP & VBCRLF
    objTextFile.Write " SUBNET MASK: " & strSubnet & VBCRLF & VBCRLF
     
    Next
     
    Next
     
    Set colNicConfigs =NOTHING
     
     
    '============================================================
     
    objTextFile.Write " " & VBCRLF & VBCRLF & VBCRLF & VBCRLF & "APPLICATION" & VBCRLF 
     
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
     
    strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
    objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
     
    For Each subkey In arrSubKeys
    strSubKeyPath = strKeyPath & "\" & subkey
     
    strString = "DisplayName"
    objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubKeyPath, strString, strDisplayName
     
    strString = "DisplayVersion"
    objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubKeyPath, strString, strDisplayVersion
     
    strDisplayName=Trim(strDisplayName)
    strDisplayVersion=Trim(strDisplayVersion)
    If strDisplayName <> "" And strDisplayVersion <> "" Then
    objTextFile.Write " " & strDisplayName & " " & strDisplayVersion & VBCRLF
    End If
    Next
     
     
    '===========================================
     
     
     
    'Close text file after writing logs
     
    objTextFile.Write VbCrLf
    objTextFile.Close
     
    'Clean Up
     
    SET colIESettings=NOTHING
    SET colItems=NOTHING
    SET colSettings=NOTHING
    SET colDisks=NOTHING
    SET AdapterSet=NOTHING
    SET objWMIService=NOTHING
    SET objWMIService2=NOTHING
    SET objFSO=NOTHING
    SET objTextFile=NOTHING
     
     
    '===================================================================
    END SUB
     
     
     
    Function HostOnline(strComputername)
     
     
    Set sTempFolder = objFso.GetSpecialFolder(TEMPFOLDER)
    sTempFile = objFso.GetTempName
    sTempFile = sTempFolder & "\" & sTempFile
     
    objShell.Run "cmd /c ping -n 2 -l 8 " & strComputername & ">" & sTempFile,0,True
     
    Set oFile = objFso.GetFile(sTempFile)
    set oTS = oFile.OpenAsTextStream(ForReading)
    do while oTS.AtEndOfStream <> True
    sReturn = oTS.ReadLine
    if instr(sReturn, "Reply")>0 then
    HostOnline = True
    Exit Do
    End If
    Loop
     
    ots.Close
    oFile.delete
    End Function
     

     

    sabato 24 marzo 2012 11:52
  • Please modify the file as you need.  Ask quesions about wjhat you do not understand.

    The is not a forum wher eyou can ask other people to write scripts for you.

    I andothers have posted code that does nearly everything you need.  It is up to you to mocify these scripts to you needs.

    I also asked you to ewmove the incorrectr line'One Error Resume Next' ar the beginning of the report and fix the remaining problems that you will find.  You have e chosen not to even attempt to do that muxh.

    I suggest you start here and learn what scripting is.

    http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx


    ¯\_(ツ)_/¯


    • Modificato jrv sabato 24 marzo 2012 15:59
    sabato 24 marzo 2012 15:55
  • JRV,

    This script able to pull software information but not able to pull OS Information ,service pack ,IE VERSION IN SAME EXCEL.

    I have tried but still not able to collect

    can you please guild.

    ' Declare Variables
    Dim dTtle
    dTtle = "Enumerate Software"
    Dim dHost
    'Provide prompt to specify audit system
    dHost = InputBox("Enter the I.P. or the computer " & _ 
                           If IsEmpty(dHost) Then WScript.Quit
    dHost = Trim(dHost)
    If dHost = "" Then dHost = "."
                        
    'Provide prompt to specify save location & further declaration
    Dim dFdl
    dFdl = InputBox("Enter the pathname to output the details of this audit " , dTtle)
    Dim dFle
    dFle = dFdl & dHost & ".xls"
     
    If IsEmpty(dFdl) Then WScript.Quit
     
    'Create & launch Excel workbook   
    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True
    Set objWorkbook = objExcel.Workbooks.Add()
    Set objWorksheet = objWorkbook.Worksheets(1)
    x = 2
     
    objExcel.Cells(1, 1).Value = "Name"
    objExcel.Cells(1, 2).Value = "Vendor"
    objExcel.Cells(1, 3).Value = "Version"
    objExcel.Cells(1, 4).Value = "InstallLocation"
    objExcel.Cells(1, 5).Value = "Description"
    objExcel.Cells(1, 6).Value = "INTERNET EXPLORER"
    objExcel.Cells(1, 7).Value = "Operating System"
     
    'Access the required WMI namespace to perform query
    Set objWMIService = _
        GetObject("winmgmts:\\" & dHost & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery _
        ("Select * from Win32_Product")

    Set colIESettings = objWMIService.ExecQuery _
        ("Select * from MicrosoftIE_Summary")

    Set colProcs = objWMIService.ExecQuery _
        ("SELECT * FROM Win32_OperatingSystem")

     
    'Perform FOR EACH loop and update newly created spreadsheet
    For Each objItem in colItems
        objWorksheet.Cells(x, 1) = objItem.Name
        objWorksheet.Cells(x, 2) = objItem.Vendor
        objWorksheet.Cells(x, 3) = objItem.Version 
        objWorksheet.Cells(x, 4) = objItem.InstallLocation
        objWorksheet.Cells(x, 5) = objItem.Description
        
               
        x = x + 1
    Next
     
    Set objRange = objWorksheet.UsedRange
    objRange.EntireColumn.Autofit()
     
    'Save & close updated spreadsheet.
    objExcel.ActiveWorkbook.SaveAs dFle
    objExcel.ActiveWorkbook.Close
    objExcel.Application.Quit
     
    WScript.Echo "Software Enumeration Complete."
    WScript.Quit

    lunedì 26 marzo 2012 05:29
  • What is the problem of the code you posted here is there any specific part that is not working?
    lunedì 26 marzo 2012 06:49
    Moderatore
  • That is correct.  Th einformation is not tabular but is hierarchical.  A spreadshe4et is tabular.  Tou can only pull it as XML or into sepearate spreadsheets.

    It is what is called a relational set.   spreadsheet is a flat representation of data - a single table.

    Here is about the best youcan get with this kind of information.

    Const XML_FILE="systeminfo.xml"
    computer="localhost"
    
    Set fso=CreateObject("Scripting.FileSystemObject")
    Set outfile=fso.CreateTextFile( XML_FILE, True ) 
    
    
    outfile.WriteLine "<?xml version='1.0' encoding='us-ascii' ?>"
    outfile.WriteLine  "<Systems>"
    GetSystemInfo computer
    outfile.WriteLine  "</Systems>"
    outfile.Close
    ' display file
    CreateObject("WScript.Shell").Run(XML_FILE)
    
    Sub GetSystemInfo(computer)
    
        Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2\Applications\MicrosoftIE") 
        Set IESettings = wmi.ExecQuery("Select * from MicrosoftIE_Summary") 
        Set wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2") 
        Set processor = wmi.ExecQuery("Select * from Win32_Processor") 
        Set BIOS = wmi.ExecQuery("Select * from Win32_BIOS") 
        Set ComputerSystem = wmi.ExecQuery("Select * from Win32_ComputerSystem") 
        Set OperatingSystem = wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem") 
        Set NTDomain = wmi.ExecQuery("Select * from Win32_NTDomain") 
        Set BaseBoard = wmi.ExecQuery("Select * from Win32_BaseBoard",,48) 
        Set LogicalDisk = wmi.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = 3") 
        Set NetworkAdapterConfiguration = wmi.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True") 
    
        For Each system in ComputerSystem 
            outfile.WriteLine  "<System Name=""" & system.Caption & """" _
                               & " Domain=""" & system.Domain & """>"
        Next 
        For Each objItem in NTDomain 
            'outfile.WriteLine  " DOMAIN NAME: " & objItem.DomainName 
        Next 
    
        For Each strIESetting In IESettings 
            outfile.WriteLine  "<IExplorer Name=""" & strIESetting.Name & """ Version=""" & strIESetting.Version & """/>"
        Next
                  
     
        For Each os in OperatingSystem 
            outfile.Write vbTab & vbTab & vbTab &  "<OperatingSystem Name=""" & os.Caption & """"
            outfile.Write " Version=""" & os.Version & """"
            outfile.WriteLine  " ServicePack=""" & os.ServicePackMajorVersion & "." & os.ServicePackMinorVersion & """/>"
        Next 
         
        outfile.WriteLine  vbTab & vbTab & "<Hardware>" 
         
        For Each objComputer in ComputerSystem 
            outfile.WriteLine  "<Processor Name=""" & objComputer.Name & """" _
                               & " NumberOfProcessors=""" & objComputer.NumberOfProcessors & """/>"
        Next 
        
        For Each objItem in BaseBoard 
            outfile.Write  vbTab & vbTab & vbTab &  "<BaseBoard Manufacturer=""" & objItem.Manufacturer & """ "
            outfile.WriteLine  "Product=""" & objItem.Product & """/>"
        Next 
     
        For Each objItem in BIOS 
            outfile.Write  vbTab & vbTab & vbTab &  "<Bios Manufacturer=""" & objItem.Manufacturer & """ "
            outfile.WriteLine  " Version=""" & objItem.Version & """/>"
        Next 
         
        For Each objComputer in ComputerSystem 
            outfile.Write  vbTab & vbTab & vbTab &  "<Memory TotalPhysicalMemory=""" & objComputer.TotalPhysicalMemory & """/>"
        Next 
        
        outfile.WriteLine  vbTab & vbTab & "<Disks>"
        For Each objDisk in LogicalDisk 
            outfile.WriteLine  vbTab & vbTab & vbTab &  "<Disk Name=""" & objDisk.DeviceID _
                & """ FileSystem=""" & objDisk.FileSystem _
                & """ Size=""" &objDisk.Size _
                & """ FreeSpace=""" & objDisk.FreeSpace & """/>"
        Next 
        outfile.WriteLine  vbTab & vbTab & "</Disks>"
        
        outfile.WriteLine  vbTab & vbTab & "<NetworkAdapters>"
        For Each adapter In NetworkAdapterConfiguration 
            outfile.Write  vbTab & vbTab & vbTab & "<Adapter Name=""" & adapter.Description & """ "
            For Each IPAddress In adapter.IPAddress 
                 
                For Each IPSubnet In adapter.IPSubnet 
                    IPSubnet = IPSubnet & "/" & IPSubnet
                Next 
                 
                outfile.Write  "IPAddress=""" & IPAddress & """ "
                outfile.Write  "IPSubnet=""" & IPSubnet  & """"
             
            Next 
            outfile.WriteLine  "/>"
        Next 
        outfile.WriteLine  vbTab & vbTab & "</NetworkAdapters>"
    
        outfile.WriteLine  vbTab & vbTab & "</Hardware>"  
        
        outfile.WriteLine  vbTab & vbTab & "<Applications>"
        Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\default:StdRegProv") 
        
        Const HKEY_LOCAL_MACHINE = &H80000002 
        Const strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" 
        objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys 'HKEY_LOCAL_MACHINE 
        For Each subkey In arrSubKeys 
            strSubKeyPath = strKeyPath & "\" & subkey 
             
            strString = "DisplayName" 
            objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubKeyPath, strString, strDisplayName 
             
            strString = "DisplayVersion" 
            objReg.GetStringValue HKEY_LOCAL_MACHINE, strSubKeyPath, strString, strDisplayVersion 
             
            strDisplayName=Trim(strDisplayName) 
            strDisplayVersion=Trim(strDisplayVersion) 
            If strDisplayName <> "" And strDisplayVersion <> "" Then 
                outfile.WriteLine vbTab & vbTab & vbTab & "<Application " _
                     & " DisplayName=""" & Replace(strDisplayName,"®","") & """" _
                     & " DisplayVersion=""" & strDisplayVersion & """" _
                     & "/>"
            End If
        Next 
        outfile.WriteLine  vbTab & vbTab & "</Applications>"
        outfile.WriteLine  vbTab & "</System>"
    End Sub 
    
    <style type="text/css"></style>


    ¯\_(ツ)_/¯

    lunedì 26 marzo 2012 08:33
  • Here is the same code as a link to the repository.

    http://gallery.technet.microsoft.com/scriptcenter/Generate-system-information-3f40629f


    ¯\_(ツ)_/¯

    lunedì 26 marzo 2012 08:53
  • jrv,

    Thanks for your input and this script is giving almost all information which required.

    The only challange is we need to pull information for all desktops /laptops from org nearly 5000+ so can you suggest is there you can do anything in this scriot which will take input as test file contacn 100+ desktops names or IP and it will create xml file for each computer in some shared location ?

    or can we run this vb sctipt as login script and pull out file in some shared location ?

    Mangesh

    lunedì 26 marzo 2012 10:23
  • jrv,

    Thanks for your input and this script is giving almost all information which required.

    The only challange is we need to pull information for all desktops /laptops from org nearly 5000+ so can you suggest is there you can do anything in this scriot which will take input as test file contacn 100+ desktops names or IP and it will create xml file for each computer in some shared location ?

    or can we run this vb sctipt as login script and pull out file in some shared location ?

    Mangesh

    Just modify the script to red input from a file.  Call teh functiop in a loop and it will generate a single file for all systems.


    ¯\_(ツ)_/¯

    lunedì 26 marzo 2012 16:09