Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use Powershell script to ftp

Posted on 2016-09-26
10
Medium Priority
?
165 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 1000 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 71

Assisted Solution

by:Qlemo
Qlemo earned 1000 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
Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

 
LVL 71

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 71

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 71

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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

688 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