【问题标题】:Get-Credential for IIS FTP User with Virtual Host Name Prefix?使用虚拟主机名前缀获取 IIS FTP 用户的凭据?
【发布时间】:2017-05-17 21:14:33
【问题描述】:

我们的第三方 IIS 团队提供带有虚拟主机名前缀的 IIS FTP 用户名。例如:“x.y.z.com|Username”(注意管道分隔符)。

运行 PowerShell Get-Credential 命令:

Get-Credential | Export-Clixml {FILEPATH} 

然后在弹出窗口中提供“用户名”=“x.y.z.com|用户名”会提供此工具提示错误:

Examples: 
User Name 
username@domain 
DOMAIN\

我可以手动生成安全字符串并导入/导出,但我希望有一种简单的开箱即用方式来存储此凭据。

一些背景: https://www.iis.net/configreference/system.ftpserver/serverruntime/hostnamesupport https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.security/get-credential

【问题讨论】:

    标签: powershell security iis ftp


    【解决方案1】:

    一种不使用 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"
    

    验证密码:

    (New-Object PSCredential "dummyuserignore", `
    (Import-CliXml "FILEPATH").Password).GetNetworkCredential().Password
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-10
      • 1970-01-01
      • 1970-01-01
      • 2015-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多