Friday, October 05, 2012

How to start/stop Hyper-V machines with PowerShell

Being a Hyper-V fan, I try to keep all of my VM’s named and line up correctly.  The problem is that with so many versions of SharePoint, SQL, OS.  The management of those VM’s can get a bit tricky.  For instance, I have 3 SharePoint farms that I might need to run at one point or another.  The problem that I had, was that I wanted to start a farm or a set of vm’s with a single script.  Well, trying to start up all of your vm’s at once creates a problem when you try to start a SharePoint farm.

The dependencies for SharePoint is that the SQL server needs to be up and running as well as the Domain controller.  For the SQL Server to start, it needs the Domain controller to be up and running.  So somehow, you need to start the AD, wait for it to be up and running before starting the SQL, and then finally when both are running, then you can start your SharePoint server.  This sequence does not allow you to get a cup of coffee while all of the vm’s are starting.  You need to monitor the state of each server before  moving to the next one.

The workflow will be something like this:  AD –>  SQL –> SharePoint

Now, enter PowerShell.  With PowerShell, I have several scripts that will perform this workflow correctly.  If you are still running Windows Server 2008-R2 as your desktop machine (and who isn't, right?), you can download the Powershell Management Library for Hyper-V in Codeplex.  This module is necessary, even if you are running PowerShell v3.


Here is my script to start up the VM machines.  Noticed that I’m using the HearBeatTimeOut.  This parameter waits for the OS to be up and running before the next command is executed!
Import-Module "C:\Program Files\modules\HyperV\HyperV.psd1"

start-vm "DemoAD" -HeartBeatTimeOut 300
start-vm "DemoSQL2008" -HeartBeatTimeOut 300
start-vm "DemoWFE1" -HeartBeatTimeOut 300

and the script to stop them.  It is always nice to use the reason parameter. This parameter is needed so that I don’t have to explain WHY it was shutdown when starting the VM’s.
Import-Module "C:\Program Files\modules\HyperV\HyperV.psd1"

shutdown-vm "DemoWFE1" -force -reason "end of day"
shutdown-vm "DemoSQL2008" -force -reason "end of day"
shutdown-vm "DemoAD" -force -reason "end of day"

now, where is that cup of coffee… :)

Sunday, September 30, 2012

A new chapter…

I like to announce that I have taken a full time position as a SharePoint dude for HMB.  I’ve interviewed with them a couple of years back.  But the planets had a different lineup and we did not connect. HMB is well known for being involved in the local developer community (.NET, StirTrek, VStudio 2012 Launch, etc)  They are a local company that has been in business longer that any other local consulting company I know.  I’ve personally known many of the people that work there. BTW, Sue “Johnson” is a great recruiter.  Of course, I also get the privilege to sit right next to Rick and ask him questions about how to be a YouTube video rock star …. lol.
One of the first questions that I’ve asked was: How many people has left your company(voluntarily/involuntarily) in the past year?  The answer was a number in the single digits (one hand)… Try asking this question, the next time you are in an interview ;) #Refreshing
The fusion between technology and culture is just perfect, and I’m very glad to be part of this mix. Actually, the real reason for me joining HMB, is so that I can be part of the “Deploy It Maybe” sequel…

Saturday, July 07, 2012

Session from SharePoint Saturday–Dayton


It was a great honor to present my developer talk at the SharePoint Saturday in Dayton

You can find the slides and the demo code in here:  SharePoint Presentation and Demo Code

thanks to all the attendees and their questions.

Saturday, June 23, 2012

Speaking Engagements

This is your chance to get involved with a local development community.


come and network with some of your peers.  If you find me on the hallways, say HI. Winking smile

Saturday, March 24, 2012

One Year Anniversary

Hello world…!
It’s been quite sometime since I have posted anything to my blog.  There were lots of personal issues and family matters that took priority over my life. 
It’s been almost a year since I’ve been working for Cardinal Solutions Group (CSG). There is a saying: “..Time flies when you are having fun…”, I truly believe that this is the case.!
When I decided to take a job at CSG, I did it because I was looking for something more than just another job.  I wanted to work with  smart people who like to share their skills and knowledge with others. I wanted an opportunity where I could make a difference.
The  line between work and personal is very blurry.!  Most of the people that I’ve been working with @ CSG , are people that I would consider friends before I call them co-workers.
I would say that one of the main attractions to come work for CSG, personally, was the fact that CSG has a big professional community involvement.  I’ve known CSG guys for many years. And most of those contacts came from running into some of them at User groups, and regional conferences.
I’ve been trying to summarize my job at CSG, and honestly I can’t get enough words to describe the work in here. So to save you a 1,000 words, here is a picture…
Pura vida…!