ForEach Condition - Adding objects to output result

Hi everyone,

with below script, i want to add the result to object which is not getting the final result. could you help me here.

[email protected]()
$list = get-content -Path "C:\Temp\Servers.txt"
foreach($PC in $list){
$ComupterName = $PC
Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "*google*" -or $ -like "*hp*"} |
Select-Object @{Name="Server";Expression={$PC}}, Name , Version

$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value Server
$obj | Add-Member -MemberType NoteProperty -Name "App Name" -Value Name
$obj | Add-Member -MemberType NoteProperty -Name "App Version" -Value Version
$FinalOutput += $obj
$FinalOutput | Out-GridView

Parents Reply Children
No Data