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.
This topic is 4 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
njkaepp7
Posts: 5
Last visit: Thu Aug 05, 2021 10:54 am

Get-Credential and PowerShell 7 preview

Post by njkaepp7 »

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
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Get-Credential and PowerShell 7 preview

Post by mxtrinidad »

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: 5
Last visit: Thu Aug 05, 2021 10:54 am

Re: Get-Credential and PowerShell 7 preview

Post by njkaepp7 »

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
Posts: 399
Last visit: Tue May 16, 2023 6:52 am

Re: Get-Credential and PowerShell 7 preview

Post by mxtrinidad »

"... 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.
This topic is 4 years and 6 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked