Hello Scripting Guru's ;)
I am working on a script that to get the status report and description on a schedule basis from an external ftpServer . The requirement is to enable SSL. I tried something but get an error like this , >>>
Exception calling "GetResponse" with "0" argument(s): "SSL cannot be enabled when using a proxy."At C:\DevelopedAddOns\FTPUpload3PL\Test\TEST190613-a.ps1:25 char:39
+ $ftpresponse = $ftprequest.GetResponse <<<< ()
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
So far so good. Now, we really use some kind of Proxy configuration and everything configured in a script. Now I was searching for a way to combine the SSL thing with the Proxy settings I need to use. Is there a way to add Proxy settings on the script below somehow ?
------------------------------------------------------------------------------------------------------------------
$sourceuri = "ftp Server Address"$username = "name"
$password = "Password"
# Create an 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)
# Set FTPWebRequest method to ListDirectory
$ftprequest.Method = [System.Net.WebRequestMethods+Ftp]::ListDirectory
$ftprequest.EnableSsl = $True
$ftprequest.UseBinary = $False
$ftprequest.UsePassive = $True
$ftprequest.KeepAlive = $False
$ftpresponse = $ftprequest.GetResponse()
Write-Output $ftpresponse.StatusCode
Write-Output $ftpresponse.StatusDescription
-------------------------------------------------------------------------------------------------------------
Thanks a lot for any helpful advice.
----------------------------------------------------------- ----------------------------------------------------------- Thanks a lot Dimi