auto shell script to download a file from server

by hitzzz at 2013-01-13 15:27:58

Hello,

I need a task schedule on windows server that will automatically download a given file from an ftp server, using a shell-command line then decrypt this same file and save the file into a folder and if task finds no “new” file on ftp server - operation should be aborted.

Can anyone please help me out with the script ?

Thanks in advance

Regards,
Hitesh
by Klaas at 2013-01-14 00:11:18
Can you post the parts of the script you have written and tell us what works and what not? What errors do you get?
by hitzzz at 2013-01-14 00:19:40
Hi,

Below are 2 different url in which script is provided, I want to use any one of them.

1. http://gallery.technet.microsoft.com/sc … cb#content

2. https://github.com/ruslander/Nutshells (ftp-ls.ps1 – is the script & readme.txt is the sample script)

Thanks,
Hitesh
by Infradeploy at 2013-01-14 01:47:08
Here’s an Powershell FTP module: http://gallery.technet.microsoft.com/sc … t-db6fe0cb

Seems to me it’s usable for the things you want
by hitzzz at 2013-01-14 02:54:11
Thank you for providing the link, but I am totally noob in this and could not understand as there were so many files. I just need one file to process.
by nohandle at 2013-01-14 04:55:11
[quote=“hitzzz”]Thank you for providing the link, but I am totally noob in this and could not understand as there were so many files. I just need one file to process.[/quote]
Hi, download the module and extract it somewhere to test it. Start a new powershell session and do import-module "C] pointing to the psm1 file, to import the module. Afterwards you should confirm the module is imported by get-module psftp - if you get output you have the module imported.
Now you should be able to use these functions:
Add-FTPItem
Get-FTPChildItem
Get-FTPItem
Get-FTPItemSize
New-FTPItem
Remove-FTPItem
Rename-FTPItem
Set-FTPConnection
to check if the module is capable of what you are trying to do.
by nohandle at 2013-01-14 04:56:39
If the module is sufficient let us know, womebody will show you a proper way to use a module. Are you on powershell version 2 or version 3?