Searching for an answer to this finds a lot about GitHub credentials but nothing on this specific issue. I am starting to work with the PowerShell (PoSH) Cmdlet 'Get-Credential' because my company uses Two-factor Authentication (2FA), so a username/password won't work to remote from my desktop (user account) to a server (Admin account). Additionally, I have just started using VS Code. The issue is that when running a simple PoSH snippet, in PoSH ISE using Get-Credential I get a popup that lets me select the certificate that I need and then enter a Pin. When I run this same snippet in VS Code, the popup never appears. Does anyone understand why this is, and can I resolve it?
Here is the snippet for reference.
$serverList = Get-Content "C:\temp\Servers.txt"
$cred = Get-Credential
ForEach ($Server in $serverList){
$OS = Invoke-Command -Credential $cred -ComputerName $Server -ScriptBlock {
(get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName
}
Write-Host $Server, $OS
}
Thanks all.