Differences

This shows you the differences between the selected revisions of the page.

2016-02-03 2016-02-04
no need to import system namespace (martin) hashtable style sessionoptions initilization (martin)
Line 192: Line 192:
try try
{ {
-    $sessionOptions = New-Object WinSCP.SessionOptions +    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ 
- ···$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp +········Protocol = [WinSCP.Protocol]::Sftp 
-   $sessionOptions.HostName = "example.com" + ·······HostName = "example.com" 
-   $sessionOptions.UserName = "user" + ·······UserName = "user" 
-   $sessionOptions.Password = "mypassword" + ·······Password = "mypassword" 
-   $sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"+ ·······SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" 
 +    }
    $session = New-Object WinSCP.Session     $session = New-Object WinSCP.Session

Last modified: by martin