Finding the path & product version of a file in powershell

279 Views Asked by At

I am try to create Powershell script to search for a sacrifice file (.exe) on the same machine or another machine in the network and return all the paths of the files with the product version for each one

I used the below code but I only was able to get the path only

$filename = 'example.exe'

(gdr -PSProvider 'FileSystem' | %{ ls -r $_.root} 2>$null | where { $_.name -eq ".EXE" })

1

There are 1 best solutions below

1
Noah Sparks On
(gdr -PSProvider 'FileSystem' | %{ ls -r $_.root} 2>$null | where { $_.name -eq "$filename" } | Select FullName,@{n='Version';e={$_.versioninfo.productversion}})