1) What is the "targetName" parameter for? MSDN says "The name of the
target for which the credential is collected" which quite frankly is a
useless description.
2) Does anybody know of any cmdlets that will trigger a call to this
method. The get-credentials cmdlet seems to call the Prompt method
instead.
Thanks.
I'd have to fire up a couple of code examples to double-check, but it
looks almost like "targetName" may remove the requirement that a
username must also be entered.
read-host likely uses the Prompt() method. It only returns a string
object, and that definitely can't be used as a credential object with
other cmdlets that support it.
PS > $test=read-host "Ask"
Ask: Testing
PS > $test.gettype().fullname
System.String
PS > $test1=get-credential
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
Credential
User: foo
Password for user foo: ***
PS > $test1.gettype().fullname
System.Management.Automation.PSCredential
PS >
Note: There are 2 overloads for the method:
http://msdn.microsoft.com/en-us/library/system.management.automation.host.pshostuserinterface.promptforcredential%28VS.85%29.aspx
Marco
--
*Microsoft MVP - Windows Server - Admin Frameworks
https://mvp.support.microsoft.com/profile/Marco.Shaw
*PowerShell Co-Community Director - http://www.powershellcommunity.org
*Blog - http://marcoshaw.blogspot.com