Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

wleddy wrote:

Thanx for the reply. I have a work around saving (get-credential).password as a secure string file and then converting *that* to text. I was hoping for something less cumbersome (among other things, this requires the service account that is running the scheduled tasks of interacting with a remote SFTP server to have local log-on privs in order to save the secure string, something which has its own security risks) but I can appreciate the need for password security.

Running this under special account to protect the credentials is IMHO the only correct way.
wleddy

Thanx for the reply. I have a work around saving (get-credential).password as a secure string file and then converting *that* to text. I was hoping for something less cumbersome (among other things, this requires the service account that is running the scheduled tasks of interacting with a remote SFTP server to have local log-on privs in order to save the secure string, something which has its own security risks) but I can appreciate the need for password security.
martin

Re: how to use a stored session with powershell

wleddy wrote:

Is there a way to reference a stored session when using powershell?

WinSCP .NET assembly is deliberately isolated from WinSCP configuration by default. While you can hack it to use the stored session/site, I would not recommend it.

$session.Open($sessionOptions)
requires having the plain text password to use when building $sessionOptions, something I saved as a stored session so I wouldn't need it.

That's not a good argument. Note that the password stored in the stored session/site can be easily recovered too. You need to ensure safety of your machine to protect the password.
See https://winscp.net/eng/docs/security_credentials
wleddy

how to use a stored session with powershell

Is there a way to reference a stored session when using powershell?

$session.Open($sessionOptions)
requires having the plain text password to use when building $sessionOptions, something I saved as a stored session so I wouldn't need it.

Is there a form something like
$session.OpenSession($sessionName)
to use all the settings available for the GUI session?

Or a callable method that will return the decrypted password given a session name, which could be used in building $sessionOptions?

Thanx,
Bill