I am trying to create a simple PS script to use on SolarWinds that will push this script out and run on a bunch of computers. Essentially I need it to export the machine name, and tell me a particular software version that is installed on the computer. Think software audit. So for example I have 5 computers. I want to have this script run on all 5 machines, and append data to a csv file showing their machine names, the application name, and the application version for only applications that contain 'Office' in the name.
$Results =
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* |
Select-Object $env:computername, displayName, DisplayVersion |
where-object {$_.DisplayName -match 'office'}
$Results | Export-CSV -Append -Path \\filepath\office.csv -NoTypeInformation
Expected is that if this runs on 5 or more computers that I will end up with a csv file that when opened in excel gives me 3 columns of data. First column being the machine name of that computer, the next being the application name, and third being the application version. The computers will all append to the same csv file so in the end I have a list of all computers with that one application and its version.
I can get it to work on one computer, but when I try to run it on multiple it does not append to the same csv file.
The problem is that machine name is simply becoming the column name rather than filling out a machine name column with data.

Select-Objectto insert a calculated property =>Select-Object @{Label='ComputerName';Expression={$env:computername}},DisplayName, DisplayVersion- user6811411