Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Send-FTP Script with Error Checking?

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 01-10-2008   #1 (permalink)
Michael Trantas
Guest


 

Send-FTP Script with Error Checking?

Hi -

I'm new to PowerShell scripting and I'm trying to create a script (I'm not
sure if it is supposed to be typed withing the PowerShell window) that will
automatically FTP the contents of a directory (all SQL .BAK files) on a
server in one location to a FTP server in another location. I would also
like the script to ZIP the contents of the original directory before FTPing
them to the remote server.

The script also needs to be doing some sort of error checking so that if a
problem occurs, it can report it to me in some sort of text file...

Is this even possible? I created a .PS1 file with the following code (which
is insanely simple) to move a basic txt file from one location to another and
it worked fine minus all of the other things I want to do. Am I heading in
the right direction or not???

send-ftp -server ftp.filetransfercentral.com -user xxxxx -password xxxxx
-localfile c:\test.txt -remotefile test3.txt


Thanks in advance for the help!

Michael
mike.trantas@xxxxxx

My System SpecsSystem Spec
Old 01-10-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Send-FTP Script with Error Checking?

Michael Trantas wrote:
Quote:

> Hi -
>
> I'm new to PowerShell scripting and I'm trying to create a script (I'm not
> sure if it is supposed to be typed withing the PowerShell window) that will
> automatically FTP the contents of a directory (all SQL .BAK files) on a
> server in one location to a FTP server in another location. I would also
> like the script to ZIP the contents of the original directory before FTPing
> them to the remote server.
>
> The script also needs to be doing some sort of error checking so that if a
> problem occurs, it can report it to me in some sort of text file...
>
> Is this even possible? I created a .PS1 file with the following code (which
> is insanely simple) to move a basic txt file from one location to another and
> it worked fine minus all of the other things I want to do. Am I heading in
> the right direction or not???
>
> send-ftp -server ftp.filetransfercentral.com -user xxxxx -password xxxxx
> -localfile c:\test.txt -remotefile test3.txt
send-ftp from NetCmdlets right?

I see they support erroraction and errorvariable:
http://blogs.msdn.com/powershell/arc...rvariable.aspx

What you're asking for is all possible. I just can't do it for you
right now.

Someone else migth step up or I might be able to provide you all the
code in the next 24 hours.

If the script fails, you want an email report perhaps?

Marco


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-10-2008   #3 (permalink)
Michael Trantas
Guest


 

Re: Send-FTP Script with Error Checking?

Yes, that's exactly what I'm talking about - the process should be as follows:

ZIP the files in a directory --> FTP the ZIP file to a server in a remote
location and place in a specific directory --> report (or error check) the
transfer by sending a TXT file to my e-mail address when the transfer is
complete.

Yes, I am using NetCmdlets too.

Thank you for your help - I'm in no rush so anything you can do would be
appreciated. I just have no clue about scripting or writing code so anything
you can do would need a detailed explaination for me to understand...

Thanks again!

Michael

"Marco Shaw [MVP]" wrote:
Quote:

> Michael Trantas wrote:
Quote:

> > Hi -
> >
> > I'm new to PowerShell scripting and I'm trying to create a script (I'm not
> > sure if it is supposed to be typed withing the PowerShell window) that will
> > automatically FTP the contents of a directory (all SQL .BAK files) on a
> > server in one location to a FTP server in another location. I would also
> > like the script to ZIP the contents of the original directory before FTPing
> > them to the remote server.
> >
> > The script also needs to be doing some sort of error checking so that if a
> > problem occurs, it can report it to me in some sort of text file...
> >
> > Is this even possible? I created a .PS1 file with the following code (which
> > is insanely simple) to move a basic txt file from one location to another and
> > it worked fine minus all of the other things I want to do. Am I heading in
> > the right direction or not???
> >
> > send-ftp -server ftp.filetransfercentral.com -user xxxxx -password xxxxx
> > -localfile c:\test.txt -remotefile test3.txt
>
> send-ftp from NetCmdlets right?
>
> I see they support erroraction and errorvariable:
> http://blogs.msdn.com/powershell/arc...rvariable.aspx
>
> What you're asking for is all possible. I just can't do it for you
> right now.
>
> Someone else migth step up or I might be able to provide you all the
> code in the next 24 hours.
>
> If the script fails, you want an email report perhaps?
>
> Marco
>
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Old 01-10-2008   #4 (permalink)
Michael Trantas
Guest


 

Re: Send-FTP Script with Error Checking?

The other variable I forgot to include in this is that while it is being
zipped, it needs to be encrypted. The SQL data included in these BAK files
contains social security numbers so it needs to be highly secure.

I know that this throws a wrench into the whole process so I'll apologize
now before it gets too hairy.

"Michael Trantas" wrote:
Quote:

> Yes, that's exactly what I'm talking about - the process should be as follows:
>
> ZIP the files in a directory --> FTP the ZIP file to a server in a remote
> location and place in a specific directory --> report (or error check) the
> transfer by sending a TXT file to my e-mail address when the transfer is
> complete.
>
> Yes, I am using NetCmdlets too.
>
> Thank you for your help - I'm in no rush so anything you can do would be
> appreciated. I just have no clue about scripting or writing code so anything
> you can do would need a detailed explaination for me to understand...
>
> Thanks again!
>
> Michael
>
> "Marco Shaw [MVP]" wrote:
>
Quote:

> > Michael Trantas wrote:
Quote:

> > > Hi -
> > >
> > > I'm new to PowerShell scripting and I'm trying to create a script (I'm not
> > > sure if it is supposed to be typed withing the PowerShell window) that will
> > > automatically FTP the contents of a directory (all SQL .BAK files) on a
> > > server in one location to a FTP server in another location. I would also
> > > like the script to ZIP the contents of the original directory before FTPing
> > > them to the remote server.
> > >
> > > The script also needs to be doing some sort of error checking so that if a
> > > problem occurs, it can report it to me in some sort of text file...
> > >
> > > Is this even possible? I created a .PS1 file with the following code (which
> > > is insanely simple) to move a basic txt file from one location to another and
> > > it worked fine minus all of the other things I want to do. Am I heading in
> > > the right direction or not???
> > >
> > > send-ftp -server ftp.filetransfercentral.com -user xxxxx -password xxxxx
> > > -localfile c:\test.txt -remotefile test3.txt
> >
> > send-ftp from NetCmdlets right?
> >
> > I see they support erroraction and errorvariable:
> > http://blogs.msdn.com/powershell/arc...rvariable.aspx
> >
> > What you're asking for is all possible. I just can't do it for you
> > right now.
> >
> > Someone else migth step up or I might be able to provide you all the
> > code in the next 24 hours.
> >
> > If the script fails, you want an email report perhaps?
> >
> > Marco
> >
> >
> > --
> > Microsoft MVP - Windows PowerShell
> > http://www.microsoft.com/mvp
> >
> > PowerGadgets MVP
> > http://www.powergadgets.com/mvp
> >
> > Blog:
> > http://marcoshaw.blogspot.com
> >
My System SpecsSystem Spec
Old 01-10-2008   #5 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Send-FTP Script with Error Checking?

Michael Trantas wrote:
Quote:

> The other variable I forgot to include in this is that while it is being
> zipped, it needs to be encrypted. The SQL data included in these BAK files
> contains social security numbers so it needs to be highly secure.
>
> I know that this throws a wrench into the whole process so I'll apologize
> now before it gets too hairy.
OK, so the data needs to be encrypted or the FTP transfer or *both*?

I'm not so sure about things now, but its a good challenge.


--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
My System SpecsSystem Spec
Old 01-11-2008   #6 (permalink)
Michael Trantas
Guest


 

Re: Send-FTP Script with Error Checking?

Marco -

Initially, the ZIP file needs to be encrypted (DES or the like). I know
that the FTP transfer process is not encrypted but if you know a way to make
it encrypted, that would be great - we really don't any type of secured FTP
transmission methods right now...

Thanks again - I'm really looking forward to seeing what you come up with
and learning how you did it!

Michael

"Marco Shaw [MVP]" wrote:
Quote:

> Michael Trantas wrote:
Quote:

> > The other variable I forgot to include in this is that while it is being
> > zipped, it needs to be encrypted. The SQL data included in these BAK files
> > contains social security numbers so it needs to be highly secure.
> >
> > I know that this throws a wrench into the whole process so I'll apologize
> > now before it gets too hairy.
>
> OK, so the data needs to be encrypted or the FTP transfer or *both*?
>
> I'm not so sure about things now, but its a good challenge.
>
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
>
My System SpecsSystem Spec
Old 01-14-2008   #7 (permalink)
Marco Shaw [MVP]
Guest


 

Re: Send-FTP Script with Error Checking?

Michael Trantas wrote:
Quote:

> Marco -
>
> Initially, the ZIP file needs to be encrypted (DES or the like). I know
> that the FTP transfer process is not encrypted but if you know a way to make
> it encrypted, that would be great - we really don't any type of secured FTP
> tranmission methods right now...
Didn't have the chance to work on this yet.

I just noticed that NetCmdlets' write-zip can do AES encryption. Does
that work for you? Unencryption is done via a password though. Maybe
you needed something else like a cert or something?

Feel free to email me at marco DOT shaw AT gmail DOT com

Also, for the SSL/SSH FTP transfer, your server must also support it.
You have a system/network administrator you can ask about that?

Marco
My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inactive printer-checking script h.pedersen.amark PowerShell 5 07-16-2008 11:40 AM
Re: PS Script to automate checking date of file and delete if old Shay Levy [MVP] PowerShell 0 07-09-2008 06:19 PM
Error checking with WMI Lastreboot script TimParker PowerShell 1 06-19-2008 01:43 AM
Help with Powershell - Disk space checking script - New to PS darren1 PowerShell 5 04-26-2008 12:26 AM
Re: checking for results when executing a script Kiron PowerShell 0 12-06-2007 08:28 PM


Update your Vista Drivers Update Your Drivers Now!!

Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008