none
Powershell Script to collect the list of software installed in a system RRS feed

  • Question

  • Hi All,

    I need a Powershell script which will read the computer names from a text file and list the software installed on the computer and export it to a csv file. Output should be "Computer name" and "Softwares".

    Can anyone help me on this ?

    Friday, July 5, 2013 12:45 PM

All replies

  • This is written on a mobile freehand with no testing so you'll have to validate and tweak. You can harness the Win32_Product WMI class to achieve what you want..... Something like this should start you off:
    $computers = Get-Content "c:\computers.txt"
    $computerarray = @()
    ForEach ($computer in $computers)
    {
    $software = Get-WMIObject -Class Win32_Product -ComputerName $computer
    ForEach ($item in $software)
    {
    $computerarrayitem = New-Object PSObject -Property @{
    Computer = $computer
    Softwares = $item.name}
    $computerarray += $computerarrayitem
    }
    }
    Having never used this class I'm not familiar with the output or properties and you may have to filter the $software var with a where-object before iterating through it in the for each loop. Also youll probably need to confirm the 'name' property listed above and confirm this relates to the 'software name'. I'll be around more to help in a couple of days (when I have access to a PC) Cheers


    • Proposed as answer by IT Badger Tuesday, July 9, 2013 9:00 PM
    • Unproposed as answer by IT Badger Tuesday, July 9, 2013 9:00 PM
    • Edited by IT Badger Tuesday, July 9, 2013 9:04 PM Formatting
    • Proposed as answer by Chen VMVP Friday, July 12, 2013 10:21 AM
    • Unproposed as answer by Chen VMVP Friday, July 12, 2013 10:21 AM
    Tuesday, July 9, 2013 5:28 PM