Solved

Use Powershell script to ftp

Posted on 2016-09-26
10
149 Views
Last Modified: 2016-10-19
I have to FTP a  file on serverA  (c:\customer.txt)  to serverB  (c:\Customerb.txt )
The ftp server has an Ip of 22.22.22.22 username of test123 and password test123
I am looking into a powershell script to achieve this.  Inputs appreciated.
0
Comment
Question by:Nana Hemaa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 23

Accepted Solution

by:
Erik Bjers earned 250 total points
ID: 41817140
Do you want a script to connect to the FTP server, what do you want to do after connecting?

Here is a site with some info on scripting this

http://www.thomasmaurer.ch/2010/11/powershell-ftp-upload-and-download/
0
 
LVL 70

Assisted Solution

by:Qlemo
Qlemo earned 250 total points
ID: 41817604
Using FTPWebRequest is one way to perform FTP up/downloads, but for simple cases you can still rely on the FTP commandline tool.
@"
open 22.22.22.22
user test123 test123
binary
put c:\customer.txt c:\Customerb.txt
"@ | ftp -n -i -v

Open in new window

0
 

Author Comment

by:Nana Hemaa
ID: 41823899
Where do I execute below commands from?

@"
open 22.22.22.22
user test123 test123
binary
put c:\customer.txt c:\Customerb.txt
"@ | ftp -n -i  -v
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 70

Expert Comment

by:Qlemo
ID: 41823996
As requested, it is a PowerShell script.
0
 

Author Comment

by:Nana Hemaa
ID: 41824098
sorry ftp commandline tool confused me.  
I get "port command successful" filename invalid.
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 41824120
Run
  ftp -n -i  -v
and then paste line by line to locate which part causes the error.
0
 

Author Comment

by:Nana Hemaa
ID: 41824148
I do not understand what you want me do...Do you have a link where I can read and understand the  -n -1  -v or can you explain please ..
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 41824168
You just run
ftp -n -v -i

Open in new window

in a cmd or PowerShell prompt. That starts FTP without trying to connect and log in, and does not display a prompt.
Then you take each line of the commands above, one by one, i.e.
open 22.22.22.22

Open in new window

and so on. and paste them into the (silent) prompt, until you get the error you showed. Then tell us the line causing this.
This is required because I have no clue where the error results from, and cannot test as each FTP server behaves different.
0
 

Author Comment

by:Nana Hemaa
ID: 41824189
ok thanks will update
0
 

Author Closing Comment

by:Nana Hemaa
ID: 41850716
Could not use the solution.  Just wanted to close case
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A procedure for exporting installed hotfix details of remote computers using powershell
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question