Link to home
Start Free TrialLog in
Avatar of semogT
semogT

asked on

Export a list of all installed software to a txt file

Using the following code copied from another expert solution I want to know if it is possible to get the code result in to a TXT file:

Option Explicit

Dim ListText, S, Key

Set S = CreateObject("RegEdit.Server")

For Each Key In S.Keys("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall").SubKeys
    If Key.ExistsValue("DisplayName") Then
      ListText = ListText & Key.Values("DisplayName").Value & vbCrLf
    Else
      ListText = ListText & "(" & Key.Name & ")" & vbCrLf
    End If
Next

Wscript.Echo ListText

I want also if possible to get the same type of result but including all the hardware installed in the computer and also all the users names included the access type.

Thanks.
Avatar of golsen23
golsen23

heres a better way to do it....

On Error Resume Next
    cName = "."

    Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & cName & "\root\cimv2")
    Set cSoftware = oWMI.execQuery _
        ("SELECT * FROM Win32_Product")
    For Each oSoftware In cSoftware
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.Description
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.identifyingnumber
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.installlocation
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.installstate
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.Name
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.skunumber
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.vendor
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.Version
        Count = Count + 1
        Worksheets("sheet1").Cells(Row, Count) = oSoftware.installdate
        Count = Count + 1
        oSoftware.Caption
       
    Next
Avatar of semogT

ASKER

It is really the first time that I try to use scripts and my skills in this matter are very low.
When I run the code supplied by golsen23 nothing upon.

I want to be able to export this information to a txt or xls file.

Thanks.
There is a free app called Belarc that does what you are trying to do.
ASKER CERTIFIED SOLUTION
Avatar of LRI41
LRI41

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