Invoke-Command faster than the command itself?
问题 I was trying to measure some ways to write to files in PowerShell. No question about that but I don't understand why the first Measure-Command statement below takes longer to be executed than the 2nd statement. They are the same but in the second one I write a scriptblock to send to Invoke-Command and in the 1st one I only run the command. All informations about Invoke-Command speed I can find are about remoting. This block takes about 4 seconds: Measure-Command { $stream = [System.IO