The issue:
Our company is creating their own backup restoration tool. The tool itself will be able to look into a backup file and pull out and restore a Document, Library or Site to a restoration location in the Central Administration Site Collection. How will that tool work? Don’t ask me, I’m no developer. However I’ve been assured it will be so cool and not leak memory, or bring down my SharePoint Farms! We’ll just see.
For this tool, I was asked to create a simple script to create a directory and push the Site Collection backups to a new directory based on date and time format. I figured I’d share it with you all, it’s pretty simple. Generally I’ve setup my backups to run a .bat file script which calls on a PowerShell script which does all the real work. The batch file is a simple one liner that says: ‘powershell –command <location><filename>.ps1’
The called PowerShell script is also pretty simple. You don’t need much head scratching for this trust me. We’ll step through it.
1 – Open the SharePoint Snapin
‘Add-PSSnapin Microsoft.SharePoint.PowerShell’
2 – Get the Date and Time to a variable
‘$DTS = Get-Date -format “yyy_MM_dd_hh-mm” ‘ - Here is a guide for date time formats. Stay away from something with special characters etc. You never know how that stuff behaves.
3 – Set the location of your backups to be used in the commands that you’ll make later.
‘$Location = “f:\backup\” ‘
4 – Make the call to actually perform the Site Collection Backups
This comes in two parts, making the new directory:
‘New-Item $location\Whale\$DTS\ -type directory’ – This is per site in your collection. I’m certain you can create an additional step to call Get-SPSIte and then for each site… etc. But that was beyond the scope of my mission.
And secondly running the backup:
‘backup-spsite -identity http://whale.<domain>.com -path $location\whale\$DTS\whale_<domain>_com.bak –force’
So essentially it all looks like this:
Add-PSSnapin Microsoft.SharePoint.PowerShell
$DTS = Get-Date -format “yyy_MM_dd_hh-mm”
$Location = “f:\backup\”
New-Item $location\Whale\$DTS\ -type directory
backup-spsite -identity http://whale.<domain>.com -path $location\whale\$DTS\whale_<domain>_com.bak -force
What you’ll end up with in your directory structure is something like this.
Using windows task manager on the server you can create a simple task to call the batch file at whatever interval you need, hourly, daily, weekly whatever gets your goat.
SharePoint 2010 is my new love at work. Unfortunately my company is not utilizing it fully quite yet. We will get there I’m certain, especially if I have anything to say about it. The first book I purchased for SharePoint 2010 was Professional SharePoint 2010 Administration by Todd Klindt, Shane Young and Steve Caravajal. The book really is a must read when it comes to SharePoint Administration. The most important part for me was the fact that it doesn’t read like a technical manual, but its completely packed with most of the information you need to run a SharePoint farm at your company.
I was actually impressed with the level of detail in the book since it was released days after SharePoint 2010 went RTM. I’m sure they have an inside scoop or something. I love the ‘format’ and conventions in the book. I actually like that in all the Wrox books I’ve become a big fan buying the SharePoint Branding book (THE best cover), Begining and Professional Developing, SharePoint Designer 2010 books and have read a good 80% of every one. You’d think I’d be an expert by now..
But alas, a book can show you just so much.
By far my copy of the Admin book has seen better days, Its been to the RedSox/Mariners game, a Thanksgiving with my in-laws, the water park and most of the bathrooms I visit. Go get your copy it really is my main resource for admin data.
I’m an early 40 something Systems Administrator, specializing in Microsoft Server products, networking, hardware, Web design, infrastructure support, and end-user mentoring. I’m currently employed with a large Engineering Services Company in the Denver metro area.
It all started… ahem, in 1988 when I was sitting talking to my Navy Recruiter. I had already joined, waiting to ship out for my Navy Seals program when I asked him what I could do with Seal Training after I got out. There was a pause, and more silence…. He didn’t have a very good answer so I told him I needed to change jobs. I chose something in Electronics.
I was a Sonar Technician on Submarines for over 9.5 years. During that time I worked on many of the Navy’s top electronic submarine warfare systems. These systems had little to do with modern day computers but there were some great skills that I picked up, most notably the ability to troubleshoot any problem. Being in the Navy and Underway on a Submarine forced me to learn, and rely on myself when it comes to fixing a problem. There is no phone support, vendor, or third tier troubleshooter to fix your issue. There are only your manuals, and your skills and experience to work a problem to a successful resolution.
After leaving the Navy with a ‘Master In Electronics Certification’ I worked in Technology… the recruiting arm of technology. I worked with candidates and employers to make a successful placement. During this time I completed college in Information Systems and practiced my skills. At one point I learned that I was placing people in positions that I could do well, and earn more income doing it. It was then that I began shifting careers to Technology.
I became employed with a mid-sized A/E firm in Denver Colorado. I transitioned to Western Washington in 2005 and have held many roles within the organization. I have provided support for the end-user to the most important Enterprise systems. I have worked with consultants to design and deliver a solution, and built solutions from the ground up. I’ve helped wire offices, install server rooms, cable datacenters, move or upgrade offices, all the while not compromising customer service.
I’ve moved on from my foundational ‘IT job’ and in looking back found that it was a teriffic learning experience. Certainly in the Technology, but also in the fundamentals of life and employment. What you want, need and desire in employment. There is surely something to be said about work life balance, and companies that promote it!! I’ve moved on, happily to bigger and better challenges, some of them you’ll read here!
I’m planning on using this blog as a way to share information about technology.

