Differences
This shows you the differences between the selected revisions of the page.
2014-09-23 | 2014-09-23 | ||
Updated examples (107.5.184.201) | consistently using quotes around string arguments (martin) | ||
Line 85: | Line 85: | ||
<code powershell> | <code powershell> | ||
# Define the options for the WinSCP Session. | # Define the options for the WinSCP Session. | ||
- | $options = New-WinSCPSessionOptions -Hostname myftphost.org -Username user -password "Pword" -SshHostKeyFingerprint "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | $options = New-WinSCPSessionOptions -Hostname "myftphost.org" -Username "user" -password "Pword" -SshHostKeyFingerprint "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" |
# Open the WinSCP Session with the defined options. | # Open the WinSCP Session with the defined options. | ||
$session = Open-WinSCPSession -SessionOptions $options | $session = Open-WinSCPSession -SessionOptions $options | ||
Line 95: | Line 95: | ||
# Accomplish the same task with one line of code. | # Accomplish the same task with one line of code. | ||
# Piping the WinSCPSession into the Receive-WinSCPItem auto disposes the object after completion. | # Piping the WinSCPSession into the Receive-WinSCPItem auto disposes the object after completion. | ||
- | Open-WinSCPSession -SessionOptions (New-WinSCPSessionOptions -Hostname myftphost.org -Username user -password "Pword" -SshHostKeyFingerprint "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx") | | + | Open-WinSCPSession -SessionOptions (New-WinSCPSessionOptions -Hostname "myftphost.org" -Username "user" -password "Pword" -SshHostKeyFingerprint "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx") | |
Receive-WinSCPItem -RemoteItem "./rDir/rFile.txt" -LocalItem "C:\lDir\lFile.txt" | Receive-WinSCPItem -RemoteItem "./rDir/rFile.txt" -LocalItem "C:\lDir\lFile.txt" | ||
</code> | </code> |