Get-Credential and PowerShell 7 preview

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
User avatar
njkaepp7
Posts: 2
Joined: Sun Mar 03, 2013 12:38 pm

Get-Credential and PowerShell 7 preview

Post by njkaepp7 » Tue Oct 01, 2019 7:53 am

With PowerShell 7 preview, the get-credential cmdlet does not show the "GUI" interface like Windows PowerShell versions did. In a completely GUI application, with no command window interface, has anyone come up with a GUI workaround to prompt for credentials securely that the get-credential GUI normally would have provided?

Thanks
NK

User avatar
mxtrinidad
Site Admin
Posts: 351
Joined: Sun Mar 03, 2013 12:42 pm

Re: Get-Credential and PowerShell 7 preview

Post by mxtrinidad » Tue Oct 01, 2019 9:13 am

First, Get-Credential in PowerShell 6.2.3 (Core) and PowerShell 7 Preview versions use .NET Core framework which has no windows forms. This was meant this way to allow cross-platform compatibility. Windows components are used only with the Full .NET Framework.

Windows component is not supported in PowerShell 7. So, for now there are no workaround for the Get-Credential in GUI form in PowerShell 7.

I recommend to file a feedback suggestion at the Microsoft Github PowerShell repository at the following link: https://github.com/PowerShell/PowerShell/issues

User avatar
njkaepp7
Posts: 2
Joined: Sun Mar 03, 2013 12:38 pm

Re: Get-Credential and PowerShell 7 preview

Post by njkaepp7 » Tue Oct 01, 2019 2:14 pm

Thanks. I am able to run Windows forms with PowerShell 7 as PowerShell 7 is built on .NET Core 3 which supports Windows form. However a few things like Out-Gridview and Get-Credential, which have GUI components to them, do not work.
NK

User avatar
mxtrinidad
Site Admin
Posts: 351
Joined: Sun Mar 03, 2013 12:42 pm

Re: Get-Credential and PowerShell 7 preview

Post by mxtrinidad » Tue Oct 01, 2019 3:03 pm

"... By using the .NET Core 3.0 SDK component Windows Desktop, you can port your Windows Forms and Windows Presentation Foundation (WPF) applications. " https://docs.microsoft.com/en-us/dotnet ... t-core-3-0

Yes! But it doesn't mean existing Windows PowerShell cmdlets "Out-Gridview", "Get-Credential", and even the "Get-Help -ShowWindow".

Now, to start, I can tell you that Microsoft is experimenting with open source Avalonia (WPF-based) Framework to bring back the cmdlet Out-Gridview.
Install the following module from the PowerShell Gallery: Microsoft.PowerShell.GraphicalTools

It won't surprise me if they start working on getting the Get-Credential back using Avalonia Framework.
You can always go to their Github repository and submit a feedback about it.

Post Reply