Skip to content

Error "Windows PowerShell is in NonInteractive mode" #15

Closed

Description

When attempting to execute a task in Azure DevOps on a Windows environment, I'm encountering the following error:

"Exception calling 'ShouldContinue' with '2' argument(s): 'Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.'"
"Exceção ao chamar "ShouldContinue" com "2" argumento(s): "O Windows PowerShell está no modo NonInteractive. A funcionalidade Read e Prompt não está disponível."

Following this Stack Overflow answer, Stack Overflow answer, I resolved the problem with this task before:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Write your PowerShell commands here.
      
      if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
          Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
      }
      
      if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -ErrorAction Ignore)) {
          Install-Module PowerShellGet -MinimumVersion 2.2.1 -Scope CurrentUser -Force -AllowClobber;
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions