项目作者: smatechnologies

项目描述 :
Demonstrates running WINSCP from PowerShell for ftping files.
高级语言: PowerShell
项目地址: git://github.com/smatechnologies/winscp-powershell.git
创建时间: 2019-12-30T18:42:51Z
项目社区:https://github.com/smatechnologies/winscp-powershell

开源协议:Other

下载


WinSCP

This repo contains an example of running the WINSCP ftp program from a PowerShell script.

The intent was to keep this version as generic as possible so it could be used for as many different sites as possible. If you are running this from OpCon it will fail if there are any issues. Any other pertinant logging will be in the job output.

*Will look into adding pgp capabilities in future versions.

Prerequisites

  • WinSCP 5.15.9
  • PowerShell 5.1

Instructions

This script contains several parameters:

  • winscpPath - Path to the WINSCP .Net dll
  • localPath - path to the location in your local environment (when running in OpCon you need an extra ending slash)
  • remotePath - remote folder on the ftp site you connect to
  • hostname - ftp site you are connecting to
  • user - username used for authenticating to the ftp site
  • password - password used for authentication to the ftp site (recommend OpCon encrypted global property)
  • filename - name of the file you are trying to upload/download (supports wildcards)
  • ftpmode - ftp mode, values can be “passive” (default) or “active”
  • ftpsecure - ftps mode, values can be “none” (default), “implicit” and “explicit”
  • protocol - values are “sftp” (default),”scp”, “ftp”, “webdav”, and “s3”
  • transferMode - values are “binary” (default), “ascii”, and “automatic”
  • ssh - SSH fingerprint to use for the site
  • option - upload or download

Execution example:

  1. powershell.exe -ExecutionPolicy Bypass -File myFTP.ps1 -winscpPath "C:\Program Files (x86)\WinSCP\WinSCPnet.dll" -localPath "C:\\" -remotePath "/somedirectory" -filename "files*.txt" -hostname "someftp.com" -user "xman" -password "<encrypted>" -option "download"

Disclaimer

No Support and No Warranty are provided by SMA Technologies for this project and related material. The use of this project’s files is on your own risk.

SMA Technologies assumes no liability for damage caused by the usage of any of the files offered here via this Github repository.

License

Copyright 2020 SMA Technologies

Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contributing

We love contributions, please read our Contribution Guide to get started!

Code of Conduct

Contributor Covenant
SMA Technologies has adopted the Contributor Covenant as its Code of Conduct, and we expect project participants to adhere to it. Please read the full text so that you can understand what actions will and will not be tolerated.