使用psftp管理ftp上传下载

#安装PSFTP模块
Install-Module psftp
Get-Module psftp -ListAvailable

Import-Module psftp
$UserName = "ftpuser"
$Password = "ftppassword"
$userPassword = ConvertTo-SecureString -String $Password -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($UserName,$userPassword )

Set-FTPConnection -Credentials $cred -Server 10.0.1.7 -UsePassive
Send-FTPItem -Path ftp://10.0.1.7/CAB -LocalPath D:\a.zip -Overwrite

 

posted on 2023-03-10 15:22  momingliu11  阅读(120)  评论(0编辑  收藏  举报