Invoke-Command returns nothing when checking for file info

Hi All,

when I want to check a file info on all remote computers, I use below syntax to check it.
Invoke-Command -Session $mypss -ScriptBlock {ls C:\screxxxtall\screxxtall.msi}

But it turns nothing, and the file does exist on individual computer. see my screenshot. what cause that problem?

I can actually reproduce this behaviour with PowerSehll version 7. On version 5.1 it works just as expected. :man_shrugging:t4: But you can force PowerShell to return the objects with a Select-Object.

$ComputerNameList = 'Computer1', 'Computer2'
Invoke-Command -ComputerName $ComputerNameList -ScriptBlock {
    Get-Item -Path 'C:\screxxxtall\screxxtall.msi' | 
    Select-Object -Property *
}