Hi Rich,
The security on our servers forces me to use a pssession. I was using format-table while I'm testing so that I can visually see the output.
You're right, I don't need Exit-Pssession. I removed it.
You're snippet works with a list of servers, but it's adding additional columns in the csv file - "PSComputerName","RunspaceId","PSShowComputerName". How do I make it exclude these headers? Here's the code....
$servers = Get-Content 'c:\users\me\list.txt'
foreach ($server in $servers) {
Invoke-Command -Session $s -Scriptblock {
Get-ChildItem D:\ -recurse -filter 'oraclient*.dll' |
ForEach-Object {
[PSCustomObject]@{
HostName = $env:ComputerName
AppName = $.VersionInfo.FileDescription
Version = $.VersionInfo.FileVersionRaw
Publisher = $.VersionInfo.CompanyName
Location = $.VersionInfo.FileName
}
}
} | Export-CSV -path 'c:\users\me\apps.csv' -NoTypeInformation -Append
}