Windows – How to automate the process of fetching files from remote Windows servers

automationfile-transferremote desktopwindows

We have a handful of machines that we administer: some Windows 2003/8 and some various flavors of Unix. I need to write some sort of script/task/etc (I'm a programmer, so any language/tool is fine) that will connect to these various machines and fetch some log file data that we've had our software create on the machine and ideally delete the old data on the machine.

In Unix, this is pretty easy to do as I can merely connect via telnet/ssh or even ftp and grab what I need. For our Windows machines, however, the only guaranteed connection method we have is remote desktop. Normally, I would connect via remote desktop with a local drive that is visible remotely and copy the file then delete it. I need to automate this process.

I Googled around a bit and didn't find as much as I would hope, including a similar and unanswered question on SO https://stackoverflow.com/questions/4406573/how-to-open-remote-desktop-copy-file-programmatically.

Anybody know of any libraries or tools (preferably free) that can do this? Thanks.

Phantom bonus points if you can help me deal with sites that I need to establish a VPN connection with before connecting.

Best Answer

Can you utilize push, rather than pull?

Should be easy to write a script to gather local event logs, then ftp (or curl or whatever else sounds good) the file to wherever you need it to be.

You would then need to make a scheduled task or service out of this script.