en-US/about_WinSCP.help.txt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Topic
    about_WinSCP
    
Short Description
    PowerShell Module Wrapper for use with the WinSCP.exe and WinSCPnet.dll.
    
Long Description
    The developers of the WinSCP have exposed most if not all available methods and properties of the program to .net and COM, 
    this is a set of PowerShell Cmdlets to sit on top of that assembly to allow for easy automation and a native PowerShell 'feel' of WinSCP with PowerShell.
    
Examples
    # Create a PSCredenital Object to authenticate with.
    $credential = Get-Credential
    
    # Create new Session Options Object.
    $session = New-WinSCPSession -HostName 'myftphost.org' -Credential $credential -Protocol Ftp
    
    # List contents of the root directory on the server.
    Get-WinSCPChildItem -WinSCPSession $session -Path '/'
    
    # Send a file to the host.
    Send-WinSCPItem -WinSCPSession $session -Path 'C:\folder\file.txt' -Destination '/file.txt'
    
    # Receive a file from the server and remove it from the host after completion.
    Receive-WinSCPItem -WinSCPSession $session -Path '/file.txt' -Destination 'C:\folder\file.txt' -Remove
    
    # Remove the WinSCP Session object.
    Remove-WinSCPSession -WinSCPSession $session
    
    
    # If the WinSCP.Session Object is passed through the pipeline it will be auto-closed upon the completion of that command.
    New-WinSCPSession -HostName 'myftphost.org' -Credential (Get-Credential) -Protocol Ftp | Send-WinSCPItem -Path 'C:\File.txt' -Destination '/file.txt' -Remove
    
Keywords
    WinSCP, Ftp, Sftp