PowerShell Syntax for SessionOptions.AddRawSettings

Advertisement

pidge_84
Joined:
Posts:
2

PowerShell Syntax for SessionOptions.AddRawSettings

Hi,

Hoping you can help...I'm using the .NET assembly with PowerShell and need to add in some proxy settings. I'm using this example as a starting point:
https://winscp.net/eng/docs/library_session_listdirectory#powershell

I can't figure out the syntax I need to use in order to call the https://winscp.net/eng/docs/rawsettings method from within PowerShell. For example if I specify:
$sessionOptions.AddRawSettings = ("ProxyMethod","3")
$sessionOptions.AddRawSettings = ("ProxyHost","PROXYSERVER")
$sessionOptions.AddRawSettings = ("ProxyPort","8080")
I receive an error of:
Cannot set the Value property for PSMemberInfo object of type "System.Management.Automation.PSMethod
I'm sure I'm missing something pretty simple here, can anyone point in the right direction to how I can call the AddRawSettings in to the $SessionOptions variable within my PowerShell script?

Cheers,
Dave

Reply with quote

Advertisement

pidge_84
Joined:
Posts:
2

So it'd been a long day...

The syntax is:
$sessionOptions.AddRawSettings("ProxyMethod","3") 
$sessionOptions.AddRawSettings("ProxyHost","PROXYSERVER") 
$sessionOptions.AddRawSettings("ProxyPort","8080")

Reply with quote

Ajay
Guest

SessionOptions.AddRawSettings syntax for perl script

Hi,
I have built the SFTP script in Perl (used the sample program from this site). Its currently failing with an error
. 2017-11-23 13:34:12.209 The first key-exchange algorithm supported by the server is diffie-hellman-group1-sha1, which is below the configured warning threshold.
. 2017-11-23 13:34:12.209 
. 2017-11-23 13:34:12.209 Do you want to continue with this connection? ()
. 2017-11-23 13:34:12.209 Attempt to close connection due to fatal exception:
* 2017-11-23 13:34:12.209 Key-exchange algorithm diffie-hellman-group1-sha1 was not verified!
. 2017-11-23 13:34:12.209 Closing connection.
. 2017-11-23 13:34:12.209 Sending special code: 12
2017-11-23 13:34:12 ERROR   OLE exception from "WinSCPnet":"
Would anyone know the syntax for adding the raw settings to sessionoptions in Perl please?
$sessionOptions->{'AddRawSettings'}->{'KEX'}=$consts->{'dh-group1-sha1'};
Does not work.

Reply with quote

Ajay
Guest

Re: SessionOptions.AddRawSettings syntax for perl script

Figured it out. The Perl script AddRawSettings should look like
$sessionOptions->AddRawSettings('KEX','dh-group1-sha1');

Reply with quote

Advertisement

You can post new topics in this forum