Topic "how to use a stored session with powershell"

Author Message
wleddy
[View user's profile]

Joined: 2013-10-31
Posts: 2
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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.

Quote:
$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
_________________
Martin Prikryl
wleddy
[View user's profile]

Joined: 2013-10-31
Posts: 2
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
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License