When I run this against my list of servers I see the shell start moving like it’s outputting something, but nothing comes up. No errors either. I can manually enter a PS session to any one of the servers, run the command and it outputs that the hotfix is there.
I can run this command and everything shows up fine.
OK, so the command you’re sending works. So the only difference between your Invoke-Command and your Enter-PSSession is that the former is targeting multiple computers, whereas the latter is targeting only one computer, right? Could we test the Invoke-Command with just one computer - the same one you used for Enter-PSSession?
That’s pretty interesting. I was able to duplicate that error and it seems to be something with select-string. As an aside you could try this command if you’re just trying to find out if a hotfix is installed. The output is a little different than your first command but the logic is essentially the same
Now what’s weird about the select-string thing is that if you add a format-list * to your command you get the output. Likewise if you pipe it to get-member. It appears to be just an output view thing, so this works too:
The issue is caused by the '$matches' collection. It does not seem portable across sessions. This is because it is an array of pointers into some objects stashed in memory. When returned to a remote session it points to nothing for some reason so we get a list of null or zeros which show up as line feeds.
Adding the select forces a simle object to be created containing the string. This can be ported to a remote session.
So in addition to format-list * you could use select line or select anything really. That’s an interesting “feature”