Session in powershell

Advertisement

Fady01
Guest

Session in powershell

Hello,

I would like to know how I can call a session that i have already register in the winscp GUI

All exemple that I found require to spefify the session configuration in the powershell script :

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "example.com"
$sessionOptions.UserName = "user"
$sessionOptions.Password = "mypassword"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"

$session = New-Object WinSCP.Session

try
{
# Connect
$session.Open($sessionOptions)


Any help would be appreciate

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,252
Location:
Prague, Czechia

Re: Session in powershell

You cannot (at least not in any documented and reliable way), the assembly by purpose runs independently from the GUI configuration.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum