• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Use Powershell script to ftp

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
Nana Hemaa
Asked:
Nana Hemaa
  • 5
  • 4
2 Solutions
 
Erik BjersPrincipal Systems AdministratorCommented:
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
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
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
 
Nana HemaaAuthor Commented:
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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
As requested, it is a PowerShell script.
0
 
Nana HemaaAuthor Commented:
sorry ftp commandline tool confused me.  
I get "port command successful" filename invalid.
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Run
  ftp -n -i  -v
and then paste line by line to locate which part causes the error.
0
 
Nana HemaaAuthor Commented:
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
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
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
 
Nana HemaaAuthor Commented:
ok thanks will update
0
 
Nana HemaaAuthor Commented:
Could not use the solution.  Just wanted to close case
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improved Protection from Phishing Attacks

WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now