The Azure DevOps deployment agent (self-hosted on one of our Windows VMs) decided to stop working out of the blue, throwing this error when executing the IIS Web App Deploy
step:
Error: Unable to locate executable file: 'powershell'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable.
Has anyone else gotten this recently?
Reviewing the logs, there is a warning that indicates:
PowerShell Core (pwsh.exe) is not available on agent machine. Falling back to using Windows PowerShell (powershell.exe). This can cause reduced performance. Please install the newer version of PowerShell for improved performance.
Something is not right about this error, since A) I installed the agent using Powershell and B) I deleted the agent and was able to re-install it using PowerShell after this error occurred.
The pipeline step itself is unchanged from the default and has been running for years without a problem-- here is the YAML generated from DevOps to prove the point (apologies if spacing got messed up by SO):
steps:
- task: IISWebAppDeploymentOnMachineGroup@0
displayName: 'IIS Web App Deploy'
inputs:
WebSiteName: '$(Parameters.WebsiteName)'
TakeAppOfflineFlag: True
XmlVariableSubstitution: True