I need a PowerShell v2.0 script that will upload files to an FTP site.
The behavior is that I need to run this once / hour via Windows Task scheduler on a Windows 2003 system (hence the PowerShell 2.0). Next year I'll probably have to move to a Windows 2012 server and so I'll appreciate a script that also runs on PowerShell v4.0
I need a script that will take a username and password as command-line parameters and upload files from a directory to an ftp site which require a username and password that are passed to it on an encoded command line just like this which works from the Windows Task scheduler on Windows 2003.
This is the tricky part. We can't have username and password sitting unencrypted in files or code. It needs to be encrypted.
I've seen examples of encrypting data in files, but I really want the data encrypted on the command line to the script so that I'm not creating and managing multiple files. I've seen the encoded command capability via a site that look like:
powershell.exe -EncodedCommand DQAKAA0ACgAJACQAcABhAHIAYQBtAHMAIAA9ACAARwBlAHQALQBDAG8AbgB0AGUAbgB0ACAAJABlAG4AdgA6AFQARQBNAFAAXABwAGEAcgBhAG0AcwAuAHQAeAB0AA0ACgAJACIAUwBlAGUAIAB3AGgAaQBjAGgAIABwAGEAcgBhAG0AZQB0AGUAcgBzACAAUABvAHcAZQByAFMAaABlAGwAbAAgAGcAbwB0ADoAIAAkAHAAYQByAGEAbQBzACIADQAKAAkADQAKAA
I want to do something like this, but I can't quite figure it out.
I "don't" want scripts that take a username/password from a file that's encrypted. It has to be from the above syntax/use and that will run from the Windows 2003 Task Schedule.