如何阻止PowerShell将电子邮件地址凭据切换为域样式登录?

时间:2013-09-13 18:08:14

标签: powershell

我写了一个脚本,可以通过FTP下载一些文件。似乎一切都在那里工作正常。我正在使用FTP module here,它似乎也正常工作并保持凭证不受影响(至少不是故意的)。

使用简单的用户名在我的测试服务器上运行正常,但当我使用用户名foo@example.com连接到生产服务器时,它会尝试使用用户名example.com\foo进行连接。我不知道它在哪里更改这个用户名。

我正在创建这样的凭据:

$ftpcredentials = New-Object System.Management.Automation.PSCredential $Username, (ConvertTo-SecureString $password -AsPlainText -Force)

用于创建FTP功能的函数将$ftpcredentials对象传递到此处:

[System.Net.FtpWebRequest]$Request = [System.Net.WebRequest]::Create($Server)
$Request.Credentials = $Credentials

如何使用foo@example.com进行连接?

0 个答案:

没有答案
相关问题