question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Get-Credential` throws exception instead of prompting for input in PowerShell 5.1

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

Summary

When using preview v2022.2.0 with Windows PowerShell 5.1, this exception is throw in the integrated console when running Get-Credential.

PS C:\> Get-Credential
Get-Credential : Cannot process command because of one or more missing mandatory parameters: Credential.
At line:1 char:1
+ Get-Credential
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-Credential], ParameterBindingException
    + FullyQualifiedErrorId : MissingMandatoryParameter,Microsoft.PowerShell.Commands.GetCredentialCommand
 
PS C:\> 

This is not the case when using PowerShell Extension v2021.12.0, or when using PowerShell 7.2.1 instead of Windows PowerShell.

PowerShell Version

PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visual Studio Code Version

PS C:\> code --version
1.64.1
d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03
x64
PS C:\>

Extension Version

PS C:\> code --list-extensions --show-versions                           
ms-vscode.powershell@2021.12.0
ms-vscode.powershell-preview@2022.2.0
PS C:\>

Steps to Reproduce

  • Open Visual Studio Code
  • Install PowerShell Preview extension
  • Configure integrated console to use Windows PowerShell x64
  • Run Get-Credential (either directly in console, or by pressing F8 - makes no difference)

Visuals

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
csandfeldcommented, Feb 28, 2022

That’s great news - thanks @andschwa and @JustinGrote

1reaction
andschwacommented, Feb 22, 2022

Looks like we’ve got a fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Powershell - throw error if prompted for input
Hi,. I'm new to powershell and I was wondering if there was a way to throw an error if a script prompts for...
Read more >
Start-Job (Microsoft.PowerShell.Core)
If you type a user name, you're prompted to enter the password. Credentials are stored in a PSCredential object and the password is...
Read more >
Differences between Windows PowerShell 5.1 and ...
This article summarizes the differences and breaking changes from Windows PowerShell 5.1 and the current version of PowerShell that is based ...
Read more >
Get-Credential (Microsoft.PowerShell.Security)
The Get-Credential cmdlet creates a credential object for a specified user name and password. You can use the credential object in security operations....
Read more >
$cred = Get-Credential without asking for prompts in powershell
I am trying to run a script and i wanted to run it silently without asking for credential prompts. ... An Unexpected Error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found