Disclaimer
This is my personal blog. The opinions and views I express are my own. The information I provide is on an as-is basis. I make no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this blog and will not be liable for any errors, omissions, or delays in this information or any losses, injuries or damages arising from its use.

Get installed software from multiple computers using csv input (Powershell)

*** THIS SCRIPT IS PROVIDED WITHOUT WARRANTY, USE AT YOUR OWN RISK ***

I wrote this script in order to find out what version of McAfee Virus Scan our client machines were running. It can be used to search for any software provided you know the name, if you don’t look in Programs and Features in the Control Panel.

Usage:

The % is the wildcard, so to search for all Microsoft Software type Microsoft%. To search for all Microsoft Office Software type Microsoft Office%. To get all software installed just type in the % sign.

The script will return the Computer Name of the client, the name of the software product, the version of the software product and the date it was installed.

erroractionpreference = "SilentlyContinue"

# The directory to put your csv file of results.
# You can use a UNC path to a share if you like
$outputDir = "C:\scripts\nuggets\software.csv"

# Path to your txt file with a list of computers and testing to see if it's online
Write-Host -fore Yellow "Checking for computers that are online, this may take a while for many machines."
$arrComputers = get-Content -Path "C:\scripts\nuggets\computers.txt" | Where-Object {Test-Connection -ComputerName $_ -Quiet -Count 2} 

# What software are you searching for? 
# % is the wildcard
Write-Host
Write-Host "Type the name of the software you're looking for. (ex. McAfee% or Windows%)"
$filter = Read-host "The % sign is the wildcard character."
    if (!$filter) {
        Write-Host -fore Red "No filter set, stopping script!"
        Break
    }

$(foreach ($strComputer in $arrComputers){
    get-wmiobject -Class win32_product -computername $strComputer -Filter "Name like '$filter'" |
    Select PScomputername, Name, Version, InstallDate

    foreach ($objItem in $colItems){
        $objItem.PSComputerName
        $objItem.Name
        $objItem.Version
        $objItem.InstallDate 
     } 
 }) | Export-csv -notypeinformation $outputDir
 Write-Host
 Write-Host -fore Yellow "Script Complete"

 

3 Comments

  1. Vishal | | Reply

    I want to get output for firefox installed on multiple windows servers, I tried with Firefox% with wild character but no result in output file. Please help on this, thanks.

  2. Ganesan | | Reply

    I have found it. We need to include _SERVER parameter in the select option so that you will get an machine name as well in output file.
    Thanks,
    Ganesan G

    Thanks a lot for this script 🙂 😛

  3. Ganesan | | Reply

    after a long searching in google I found this script. It was working fine but PScomputet name is not printing. Can we get machine name in output file?

    Thanks,
    Ganesan G

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.