0
我试图通过PowerShell脚本从FTP服务器获取响应。要做到这一点,我写了下面的:使用PowerShell发送FTP请求时出现错误530
$sourceuri = "<string>"
$targetpath = "<string>"
$username = "<string>"
$password = "<string>"
# Create a FTPWebRequest object to handle the connection to the ftp server
$ftprequest = [System.Net.FtpWebRequest]::create($sourceuri)
# set the request's network credentials for an authenticated connection
$ftprequest.Credentials = New-Object System.Net.NetworkCredential($username,$password, $sourceuri)
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::DownloadFile
$ftprequest.UseBinary = $true
$ftprequest.KeepAlive = $false
# send the ftp request to the server
$ftpresponse = $ftprequest.GetResponse()
脚本执行时,它会返回错误530说我没有登录我没有PowerShell的经验,我不能确定什么,我需要添加到解决这个错误
$ sourceuri是一个我相信的字符串。拿出$ sourceuri将错误更改为550错误,我不知道如何修复 – 2015-02-05 17:38:34
@NickG这只是表示权限被拒绝。 '$ sourceuri'是一个webaddress是否正确?你可以在浏览器中使用这些凭据吗?它使用域凭据吗? – Matt 2015-02-05 17:41:39
证书在浏览器中工作。我刚刚运行了另一个脚本,它列出了我的shell中的目录并且工作正常。然而,下载脚本会抛出550错误 – 2015-02-05 18:11:46