Search code examples
powershellpowershell-4.0

Powershell query - Querying computer for listed Programs and filtering


I'm hoping you all can help me with this. I'm trying to use PowerShell to see what software is currently installed on a machine, but i want results of specific software not the entire library of installed software if that makes sense? Note - I'm new to PowerShell and I'm doing my best to learn and learn how to use/create scripts. I've tried Google!

I'm using the following to query a computer on the local network and i get a result of all software listed.

Get-Wmiobject -class Win32_product -computername "PC1" | Select-Object name,version 

Could someone help me filter the results for specific software? I also want to see the version of the software.

Any help would be appreciated! It'll certainly help towards my learning.


Solution

  • There are two ways to do it. if you know what application you looking for, you can use the following:

    Get-Wmiobject -class Win32_product -filter "name='Application Name'" | Select-Object name,version
    

    Take note that it must be the same (no case sensitive)

    if you are looking for a pattern you can use the following (which is longer to execute):

    Get-Wmiobject -class Win32_product  | Select-Object name,version | where {$_.Name -like "*Google*"} 
    

    you can add the -ComputerName parameter if you need.

    let me know how it worked for you.