AzureDevOpsExtension icon indicating copy to clipboard operation
AzureDevOpsExtension copied to clipboard

The term 'C:\Program' is not recognized as the name of a cmdlet

Open ladenedge opened this issue 3 years ago • 0 comments

Where are you running it?

On-prem Azure DevOps Server

Version of Extension/Task

10.3.10

Expected behaviour and actual behaviour

Expected Pester to run when executed by an agent installed in the Program Files directory.

However, it looks like it's not quoting itself:

powershell.exe C:\Program Files\vsts-agent-win-x64-2.160.1\_work\(snip)\10.3.10\Pester.ps1

Here's the full script output:

Starting: Run unit tests
==============================================================================
Task         : Pester Test Runner
Description  : Run Pester tests by either installing the latest version of Pester at run time (if possible) or using the version shipped with the task (5.0.0)
Version      : 10.3.10
Author       : Pester
Help         : Version: #{Build.BuildNumber}#. [More Information](https://github.com/pester/AzureDevOpsExtension)
==============================================================================
Using executable 'powershell.exe'
powershell.exe C:\Program Files\vsts-agent-win-x64-2.160.1\_work\_tasks\Pester_cca5462b-887d-4617-bf3f-dcf0d3c622e9\10.3.10\Pester.ps1 -TestFolder C:\Program Files\vsts-agent-win-x64-2.160.1\_work\3\s\* -resultsFile C:\Program Files\vsts-agent-win-x64-2.160.1\_work\3/Pester-Results.xml -run32Bit False -FailOnStdErr true -CodeCoverageOutputFile C:\Program Files\vsts-agent-win-x64-2.160.1\_work\3/Pester-Coverage.xml
##[error]C:\Program : The term 'C:\Program' is not recognized as the name of a cmdlet, 

##[error]C:\Program : The term 'C:\Program' is not recognized as the name of a cmdlet, 

##[error]function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ C:\Program Files\vsts-agent-win-x64-2.160.1\_work\_tasks\Pester_cca54 ...
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Program:String) [], CommandN 
   otFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Steps to reproduce the problem

Very simple task usage in my DevOps pipeline:

- task: Pester@10
  displayName: 'Run unit tests'
  inputs:
    resultsFile: '$(Pipeline.Workspace)/Pester-Results.xml'
    CodeCoverageOutputFile: '$(Pipeline.Workspace)/Pester-Coverage.xml'

ladenedge avatar Feb 02 '22 15:02 ladenedge