Azure DevOps PowerShell Tasks Fail with NativeCommandError RemoteException

Azure DevOps PowerShell Tasks Fail with NativeCommandError RemoteException

If you run into the error mentioned with the Hosted Build Agents on Windows - I've seen this with the Windows-2019 images -- and you're truly not using PowerShell remoting - a simple switch to the PowerShell core version of the task works - pwsh

CategoryInfo          : NotSpecified: (:String) [], RemoteException
FullyQualifiedErrorId : NativeCommandError

So, the following

  steps:
  - checkout: curl
  - powershell: |

Becomes:

  steps:
  - checkout: curl
  - pwsh: |