Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top