All, I've got a script that gets the installed Oracle client versions on our server using a Get-ChildItem command inside a script block. The output should list all the different versions found on the server in a nice tablular format with custom headers but instead puts everything in one row instead of two.
$array = @()
invoke-command -Session $s -Scriptblock { foreach-object {
for ($i=0; $i -le 5; $i++) {
($v = Get-ChildItem -Path D:\ -recurse -filter 'oraclient*.dll').VersionInfo | select-object FileVersion, FileName | Out-Null
$Version = $v.VersionInfo.FileVersionRaw
$FileName = $v.VersionInfo.FileName
$item = New-Object System.Object
$item | Add-Member -MemberType NoteProperty -Name "HostName" -Value "$Using:server"
$item | Add-Member -MemberType NoteProperty -Name "Version" -Value "$Version"
$item | Add-Member -MemberType NoteProperty -Name "FileName" -Value "$FileName"
}
$array += $item
Write-Output $array | Format-Table -AutoSize | out-string
exit-pssession
}
}
Here's what the output looks like
HostName Version FileName
MyServer01 18.0.0.0 18.0.0.0 D:\Oracle_18\product\18.0.0\client_64\bin\oraclient18.dll D:\Oracle_18_32\product\18.0.0\client_32\bin\oraclient18.dll
Here's what it should look like
HostName Version FileName
MyServer01 18.0.0.0 D:\Oracle_18\product\18.0.0\client_64\bin\oraclient18.dll
MyServer01 18.0.0.0 D:\Oracle_18_32\product\18.0.0\client_32\bin\oraclient18.dll