I cannot run powershell scripts on my machine, but maybe I could circumvent the problem by using powershell command line.
Here is what I tried:
<reference object="WinSCP.Session" />
Dim key, cmd, Shell, executor, seckey
key = "ABCABCABC....."
cmd = "powershell.exe ConvertTo-SecureString "& key
Set shell = CreateObject("WScript.Shell")
Set executor = shell.Exec(cmd)
seckey = executor.StdOut.ReadAll
sessionOptions.SecurePassword = seckey
but I get an error stating something like "SecurePassword incorrect argument" (sorry I had to translate the message into English). So, I even wonder if "SecurePassword" is supported at all in VBS.
A full VBS solution would be prefered but if I can find a workaround with a working version of the code above, I would be happy too!