new-gauser and the -shownewpassword option

20 views
Skip to first unread message

rhas...@eng.ucsd.edu

unread,
Mar 13, 2018, 7:23:31 PM3/13/18
to gshell-discuss
Hi - I'm working on writing a script that utilizes the gshell (thanks for creating the tools!)

What I need to be able to do is capture the password that is created by the new-gauser command into a variable so I can use it later.

But I can't figure out how to redirect the password into a variable - so far everything I've tried doesn't work and it only outputs the password to the console.

Is there something special about how the password is returned that would affect me being able to use it for anything else?

Thanks!

Jesper Bergman

unread,
Mar 14, 2018, 12:35:09 AM3/14/18
to gshell-discuss
Hi
Send in the parameter -Password <String>

If you need a random password, handle it with a separate function before.

Example

New-gauser -otherparameters -password "mypassword"

Or look at my script:
https://groups.google.com/forum/m/#!topic/gshell-discuss/D9TWaF2cONY

Best regards
Jesper

rhas...@eng.ucsd.edu

unread,
Mar 14, 2018, 6:13:30 PM3/14/18
to gshell-discuss
Thanks Jesper - I was just hoping I could utilize the built-in password creation, and be able to capture it to let the user know what it's been set to.

Spencer Varney

unread,
Mar 15, 2018, 1:19:02 PM3/15/18
to rhas...@eng.ucsd.edu, gshell-discuss
Jesper is correct, sorry about that! For now the password is written to the console using the C# Console.WriteLine() which is the same as PoSh's [console]::WriteLine() - and my understanding of that is this is not something that can be captured no matter how you handle it or redirect output streams (more info on that here). That, in hindsight, was not a great way to handle it.

Since gShell is under renovations I'll not be making any changes to that just now.

Regards,

Spencer

On Wed, Mar 14, 2018 at 6:13 PM <rhas...@eng.ucsd.edu> wrote:
Thanks Jesper - I was just hoping I could utilize the built-in password creation, and be able to capture it to let the user know what it's been set to.

--
You received this message because you are subscribed to the Google Groups "gshell-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gshell-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages