Get-Credential for IIS FTP User with Virtual Host Name Prefix?

0 投票
最新提问 用户: (180 分)

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

1个回答

0 投票
最新回答 用户: (180 分)

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

Still hopeful for a simpler solution using Get-Credential, but not losing sleep over it.

欢迎来到 Security Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...