Reputation: 1497
Our third-party IIS team provides IIS FTP usernames with a virtual host name prefix. For example: "x.y.z.com|Username" (note the pipe separator).
Running PowerShell Get-Credential command:
Get-Credential | Export-Clixml {FILEPATH}
and then providing "User name" = "x.y.z.com|Username" into the pop-up window provides this tooltip error:
Examples:
User Name
username@domain
DOMAIN\
I can manually generate secure strings and import/export, but I'd like to have a simple out-of-the-box way to store this credential.
Some background: https://www.iis.net/configreference/system.ftpserver/serverruntime/hostnamesupport https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.security/get-credential
Upvotes: 0
Views: 139
Reputation: 1497
One workaround which doesn't use Get-Credential:
(New-Object -TypeName System.Management.Automation.PSCredential `
-ArgumentList (Read-Host "Please enter the user name"), `
(Read-Host -assecurestring "Please enter the password")) |
Export-CliXml "FILEPATH"
Verifying the password:
(New-Object PSCredential "dummyuserignore", `
(Import-CliXml "FILEPATH").Password).GetNetworkCredential().Password
Upvotes: 0