@gjacobse said in Inconsistent output from PS script:
I mentioned that I was building another convenience script, It needs to only look at a servie running on four remote computers. This service runs to accept CC/Debit cards on a POS station. But sometimes the service borks and has to be restarted.
I have a simple batch file that does it now, but figured at some point I would move it to PS using a menu type system... and thus I have started doing so.
Oddly, I am seeing inconsistent output when it's ran. The syntax of the line didn't / doesn't change - so not sure why this happens.
Get-Service -ComputerName pc1, pc2 SERVICE | Select name, MachineName, Status
Run it once and I get nothing back, run it again and I get listed twice, run it a third time and I get what I want to see the first time.
Additionally, I have a 'title line' that I ass the -Foreground color
and it skips the first one or two letters before applying the color. seems odd, and comparing my formatting - it's no different then others I have seen...
Can you try it with Invoke-Script or Start-Job ?