VMware Cloud Community
jfierberg
Contributor
Contributor

Get-viserver credentials

How can I make a pop-up for username\password appear when executing the get-viserver cmdlet?

Reply
0 Kudos
4 Replies
admin
Immortal
Immortal

This is what I found on M$ site it makes use of the vbscript inputbox function:

$a = new-object -comobject MSScriptControl.ScriptControl
$a.language = "vbscript"
$a.addcode("function getInput() getInput = inputbox(`"Message box prompt`",`"UserName`") end function" )
$b = $a.eval("getInput")

Reply
0 Kudos
LucD
Leadership
Leadership

You could use the cmdlet Get-Credential which comes with it's own form.

And use the returned credentials as input to Get-ViServer.

Get-ViServer -Credentials (Get-Credentials)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
admin
Immortal
Immortal

Very cool, Thanks! There is no "s" though in get-credential

Reply
0 Kudos
LucD
Leadership
Leadership

Sorry about the typo


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos