The results of my script are stored in $results and I can see the results clearly by just typing
$results
or
$results | out-gridview
But I want to also show the name of the computer the results came from
If I use
$results | Select-Object -Property PSComputerName | Out-GridView
Then it just shows the computer name and not the results
How can I show both columns of information in the grid please?
The contents of $results comes from the following code being run
$regpath = 'registry::HKEY_USERS'
$results = @()
$HKUserList = Invoke-Command -ComputerName $computers { param($regpath) Get-ChildItem $regpath | Select-Object -ExpandProperty Name } -ArgumentList $regpath
ForEach ($HKUser in $HKUserList) {
$regpath2 = 'registry::' + $HKUser + '\Software\Microsoft\Office\16.0\Outlook\Search'
$PSTFind = Invoke-Command -ComputerName $computers { param($regpath2) Get-ChildItem -path $regpath2 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Property | Where-Object -FilterScript {$_ -like "*.pst"} } -ArgumentList $regpath2
ForEach ($PST in $PSTFind) {
If (Test-Path -Path $PST -PathType leaf)
{
Write-Host "PST found at '$PST'"
$results += $PST
}
}
}