I'm writing a set of Powershell Cmdlets that require Oauth2 authentication. I currently am able to get to the point where a new browser window opens and the user copies out the Access Authentication Code to pass back to the cmdlets. However, this means I have to have a separate cmdlet that now accepts the Auth Code as input.

Is there any way to invoke the Read-Host? I've tried the instructions but despite being listed, ReadHostCommand isn't showing up under the Microsoft.PowerShell.Commands namespace, but something like WhereObjectCommand is.

I've tried Console.ReadLine() but it is just ignored when running the Cmdlet.

有帮助吗?

解决方案

The ReadHostCommand is in the Microsoft.PowerShell.Commands namespace but you have to reference the Microsoft.PowerShell.Commands.Utility.dll assembly.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top