I'm trying to get a command to run on one of our servers, and then deal with the output. Problem is that the output is being displayed on one line, and not separating out onto its separate lines:-
$cmd = "openfiles"
$cmdOutput = Invoke-Expression $cmd
Is it possible to somehow keep the lines instead of it all going onto one massive line?