Powershell Backup to S3 Script

Powershell Backup to S3 Script

Have you ever used Powershell? Well, neither have I. Until recently I’d been happily scripting my server maintenance routines in batch files (I know, I know) but figured when one of our dev servers turned out to need to be a Windows Server 2012, I found that my tried and true batch files would need to be massively rewritten so I figured, time to dive into PowerShell.

There were three aspects of what the routine that I needed to address

  • Learn Powershell: Thank God for Google! Not sure how long this would have taken if I hadn’t had Google’s great search results
  • Figure out how to create and add files to a zip file. Well, it turns out the easiest way is to create a new file by adding the necessary “header” information to the file and then just start copying files to this file as if you were copying files to a folder
  • Figure out a good way to interact with S3. In the batch file I had been using S3 Browser’s s3browser-put utility but thanks to Google I found out about the Cloudberry Explorer which is freeware from Cloudberry Lab. And best of all, it includes Powershell extensions!

Well, without much more ado, here is the code:


Phew, that was a whole lot of work to replace a 7 line batchfile but I guess this is progress. Biggest “aha” moment from this exercise? I sure which Microsoft had strongly-typed the base language for Powershell. I guess I’m just too used to C# (and I like it that way).

Anyone else have some really handy Powershell scripts to share?

Of course, the final step is to get this scheduled to run on the server but that shouldn’t be too hard, should it?

Stalk Me...

Michael Gibbs

I'm a technologist at heart, assisting companies best utilize the Internet to market themselves and sell their products and services online. This includes organizations as large as Google and as small as one or two individuals.
At Over The Top and Exhibit A Communications, I've programmed solutions for Google as well as at least one other company that was later acquired by Google.

I've been CTO of an Internet SaaS company and spent my time pretty evenly between guiding the future technical strategy of the company, architecting software solutions for my dev teams, designing and running a data center to service our clients world-wide as well as being a technical evangalist/sales engineer to our media clients large and small.

I've also been Chief Photographer of the Daily Sun/Post newspaper back when it was a 5-day a week daily newspaper.

I also spent a great many years as a beach lifeguardfor the City of San Clemente as well as Jr. Lifeguard instructor and then as it's program coordinator.
Bragging rights
Private Pilot with Instrument rating and proud husband of soon to be 25 years (and counting).
Stalk Me...

Latest posts by Michael Gibbs (see all)

Leave a Reply