This morning, I was working with a new build of Windows 11 (22H2) and came across this frustrating error:

After running the Get-Credential cmdlet, the console is immediately returned to me with an error that I didn’t specify the -Credential parameter.
Interestingly, if I opened a new tab in the PS console window and ran the Get-Credential cmdlet there, it worked fine.
This appears to be a bug in PS 5.1. This bug is not present in PS 7. The interim fix is to launch an elevated PowerShell window and run the following command:
Set-ItemProperty "HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds" -Name "ConsolePrompting" -Value $True
The issue may be with calling CredUIPromptForCredentialsW and setting Windows Explorer as the process handle instead of the terminal window.

