Category Archives: Sean Kearney

Building the IT Camp with PowerShell Revisited

I always said I am not hard to please… I only need perfection.  So when I wrote my PowerShell script to build my environment the other day I was pleased with myself… until I realized a huge flaw in it.  Generation 1.

Actually to be fair, there is nothing wrong with Generation 1 virtual machines in Hyper-V; they have served us all well for several years.  However how could I claim to live on the bleeding edge (Yes, I have made that claim many times) and yet stay safe with Generation 1?

In the coming weeks Windows Server 2012 R2 will become generally available.  One of the huge changes that we will see in it is Generation 2 virtual machine hardware.  Some of the changes in hardware levels include UEFI, Secure Boot, Boot from SCSI, and the elimination of legacy hardware (including IDE controllers and Legacy NICs).

Of course, since Generation 1 hardware is still fully supported, we need to identify when we create the VM which Generation it will be, and this cannot later be changed.

I had forgotten about this, and when I created the script (of which I was quite proud) I did not think of this.  It was only a few hours later, as I was simultaneously installing nine operating systems, that I noticed in the details pane of my Hyper-V Manager that all of my VMs were actually Gen1.


Remember when I said a couple of paragraphs ago that the generation level cannot be changed?  I wasn’t kidding.  So rather than living with my mistake I went back to the drawing board.  I found the proper cmdlet switches, and modified my script accordingly.

As there is a lot of repetition in it, I am deleing six of the nine VMs from the list.  You are not missing out on anything, I assure you.

# Script to recreate the infrastructure for the course From Virtualization to the Private Cloud (R2).
# This script should be run on Windows Server 2012 R2.
# This script is intended to be run within the Boot2VHDX environment created by Mitch Garvis
# All VMs will be created as Generation 2 VMs (except the vCenter VM for which it is not supported).
# All VMs will be configured for Windows Server 2012 R2
# System Center 2012 R2 will be installed.

# Variables

$ADM = "Admin"                # VM running Windows 8.1 (for Administration)
$ADMMIN = 512MB                # Minimum RAM for Admin
$ADMMAX = 2GB                # Maximum RAM for Admin
$ADMVHD = 80GB                # Size of Hard Drive for Admin

$SQL = "SQL"                # VM (SQL Server)
$SQLMIN = 2048MB            # Minimum RAM assigned to SQL
$SQLMAX = 8192MB            # Maximum RAM assigned to SQL
$SQLCPU = 2                # Number of CPUs assigned to SQL
$SQLVHD = 200GB                # Size of Hard Drive for SQL

$VCS = "vCenter"             # VM (vSphere vCenter Cerver) (Windows Server 2008 R2)
$VCSMIN = 2048MB             # Minimum RAM assigned to vCenter
$VCSMAX = 4096MB             # Maximum RAM assigned to vCenter
$VCSCPU = 2                 # Number of CPUs assigned to vCenter
$VCSVHD = 200GB                # Size of Hard Drive for vCenter

$VMLOC = "C:\HyperV"            # Location of the VM and VHDX files

$NetworkSwitch1 = "CorpNet"        # Name of the Internal Network

$W81 = "E:\ISOs\Windows 8.1 E64.iso"            # Windows 8.1 Enterprise
$WSR2 = "E:\ISOs\Windows Server 2012 R2.iso"        # Windows Server 2012 R2
$W2K8 = "E:\ISOs\Windows Server 2008 R2 SP1.iso"     # Windows Server 2008 R2 SP1

# Create VM Folder and Network Switch
MD $VMLOC -ErrorAction SilentlyContinue
$TestSwitch1 = Get-VMSwitch -Name $NetworkSwitch1 -ErrorAction SilentlyContinue; if ($TestSwitch1.Count -EQ 0){New-VMSwitch -Name $NetworkSwitch1 -SwitchType Internal}

# Create & Configure Virtual Machines
New-VM -Name $ADM -Generation 2 -Path $VMLOC -MemoryStartupBytes $ADMMIN -NewVHDPath $VMLOC\$ADM.vhdx -NewVHDSizeBytes $ADMVHD -SwitchName $NetworkSwitch1
Set-VM -Name $ADM -DynamicMemory -MemoryMinimumBytes $ADMMIN -MemoryMaximumBytes $ADMMAX
Add-VMDvdDrive $ADM | Set-VMDvdDrive -VMName $ADM -Path $W81

New-VM -Name $SQL -Generation 2 -Path $VMLOC -MemoryStartupBytes $SQLMIN -NewVHDPath $VMLOC\$SQL.vhdx -NewVHDSizeBytes $SQLVHD -SwitchName $NetworkSwitch1
Set-VM -Name $SQL -DynamicMemory -MemoryMinimumBytes $SQLMIN -MemoryMaximumBytes $SQLMAX -ProcessorCount $SQLCPU
Add-VMDvdDrive $SQL | Set-VMDvdDrive -VMName $SQL -Path $WSR2

New-VM -Name $VCS -Path $VMLOC -MemoryStartupBytes $VCSMIN -NewVHDPath $VMLOC\$VCS.vhdx -NewVHDSizeBytes $VCSVHD -SwitchName $NetworkSwitch1
Set-VM -Name $VCS -DynamicMemory -MemoryMinimumBytes $VCSMIN -MemoryMaximumBytes $VCSMAX -ProcessorCount $VCSCPU
Set-VMDvdDrive -VMName $VCS -Path $W2K8

#Start Virtual Machines
Start-VM $ADM
Start-VM $SQL
Start-VM $VCS

In the script you can see a few differences between my original script (in the article) and this one.  Firstly on all machines that are running Windows 8.1 or Windows Server 2012 R2 I have set the switch –Generation 2.  That is simple enough.

Adding the virtual DVD was a little trickier; with Generation 1 hardware there was a ready IDE port for you to connect the .ISO file to.  In Gen 2 it is all about SCSI, so you have to use the Add-VMDvdDrive cmdlet, and then connect the .ISO file (Set-VMDvdDrive –VMName <Name> –Path <ISO Path>Not only for simplicity but also to demonstrate that you can I have put these two cmdlets on a single line, connected with a pipe (the | key).

I want to thank a couple of colleagues for helping me out with the Generation 2 hardware and DVD issues… especially Sergey Meshcheryakov , who was quick to answer.  The exact cmdlet switches were not easy to track down!

…and remember, if I can learn it, so can you!  Even the great Sean Kearney once did not know anything about PowerShell… and now look at him!

Managing Hyper-V Virtual Machines with Windows PowerShell

Warning: The following post was written by a scripting luddite.  The author readily admits that he would have difficulty coding his way out of a paper bag, and if the fate of the world depended on his ability to either write code or develop software then you had better start hoarding bottled water and cans of tuna.  Fortunately for everyone, there are heroes to help him!

I love the Graphical User Interface (GUI).  I use it every day in both the Windows client and Windows Server operating systems.  It makes my life easier on a day to day basis.

With that being said, there are several tasks that administrators must do on a regular basis.  There is no simple and reliable way to create repetitive task macros in the GUI.  Hence we can either work harder, or we can learn to use scripting tools like Windows PowerShell.

Along the way I have gotten some help from some friends.  Ed Wilson’s books have provided a wealth of information for me, and Sean Kearney has been my go-to guy when I need help.  There was a time when I was teaching a class and was asked ‘Can PowerShell do that?’  I replied by saying that if I asked Sean Kearney to write a PowerShell script to tie my shoes, I was reasonably sure he could do it because PowerShell can do ANYTHING.  Well one of my students posted that comment on Twitter, and got the following reply from Sean (@EnergizedTech):

Get-Shoe | Invoke-Tie

It makes sense too…because PowerShell works with a very simple Verb-Noun structure, and if you speak English it is easy to learn.

I may be a scripting luddite, but I do know a thing or two about virtualization, and especially Hyper-V.  So it only stands to reason that if I was going to start learning (and even scarier, teaching) PowerShell, I would start with the Hyper-V module.  As a good little Microsoft MVP and Community Leader, it only makes sense that I would take you along for the ride :)

Most of what can be done in PowerShell can also be done in the GUI.  If I want to see a list of the virtual machines on my system, I simply open the Hyper-V Manager and there it is.


PowerShell is almost as simple… Type Get-VM.


By the way you can filter it… if you only want virtual machines that start with the letter S, try:

Get-VM S*

One of the advantages of PowerShell is that it allows you to manage remote servers, rather than having to log into them you can simply run scripts against them.  If you have a server called SWMI-Host1, you can simply type:

Get-VM –Server SWMI-Host1

Starting and stopping virtual machines is simple…

Start-VM Admin


Again, your wildcards will work here:

Start-VM O*

This command will start all VMs that start with the letter O.

If you want to check how much memory you have assigned to all of your virtual machines (very useful when planning as well as reporting) simply run the command:

Get-VMMemory *


I did mention that you could use this command for reporting… to make it into an HTML report run the following:

Get-VMMemory * | ConvertTo-HTML | Out-File c:\VMs\MemReport.htm

To make it into a comma separated values (CSV) file that can easily be read in Microsoft Office Excel, just change the command slightly:

Get-VMMemory * | ConvertTo-CSV | Out-File c:\VMs\MemReport.csv

The report created is much more detailed than the original screen output, but not so much so as to be unusable.  See:

Making Changes

So far we have looked at VMs, we have started and stopped them… but we haven’t actually made any changes to them. Let’s create a new virtual machine, then make the changes we would make in a real world scenario.

New-VM –Name PSblog –MemoryStartupBytes 1024MB –NewVHDPath c:\VHDs\PSblog.vhdx –NewVHDSizeBytes 40GB –SwitchName CorpNet

With this simple script I created a virtual machine named PSblog with 1024MB of RAM, a new virtual hard disk called PSblog.vhdx that is 40GB in size, and connected it to CorpNet.

Now that will work, but you are stuck with static memory.  Seeing as one of the great features of Hyper-V is Dynamic Memory, let’s use it with the following script:

Set-VMMemory –VMName PSblog –DynamicMemoryEnabled $true –MinimumBytes 512MB –StartupBytes 1024MB MaximumBytes 2048MB

Now we’ve enabled dynamic memory for this VM, setting the minimum to 512MB, the maximum to 2048MB, and of course the startup RAM to 1024MB.

For the virtual machine we are creating we might need multiple CPUs, and because some of our hosts may be newer and other ones older we should set the compatibility mode on the virtual CPU to make sure we can Live Migrate between all of our Intel-based hosts:

Set-VMProcessor –VMName PSblog –Count 4 –CompatibilityForMigrationEnabled $true

At this point we have created a new virtual machine, configured processor, memory, networking, and storage (the four food groups of virtualization), and are ready to go.

I will be delving deeper into Hyper-V management with PowerShell over the next few weeks, so stay tuned!

NOTE: While nothing in this article is plagiarized, I do want to thank a number of sources, on whose expertise I have leaned rather heavily.  Brien Posey has a great series of articles on Managing Hyper-V From the Command Line on which is definitely worth reading.  He focuses on an add-on set of tools called the Hyper-V Management Library (available from so many of the scripts he discusses are not available out of the box, but the articles are definitely worth a read.  Rob McShinsky has an article on SearchServerVirtualization (a property) called Making sense of new Hyper-V 2012 PowerShell cmdlets which is great, and links to several scripts for both Server 2008 R2 and Server 2012.  Thanks to both of them for lending me a crutch… you are both worthy of your MVP Awards!

A Truly Energized Post: Sean’s experience buying his Microsoft Surface

This post was sent to me by the original Energized Tech and former Friday Funny Guy.  Sean Kearney is not only a Microsoft MVP (PowerShell), he is a good friend and certainly among the most passionate technology enthusiasts and Microsoft fans I have ever had the pleasure of knowing.  Sean will be assisting me at the official opening of the first international Microsoft Store in the Yorkdale Mall (Toronto) on November 16th.

Occasionally he does release the krakken (as he puts it) and on October 26th – the day the Microsoft Pop-Up Store opened at Toronto’s Eaton Centre, the day that the Microsoft Surface was released – he did just that; he was near the front of the line and as such one of the first Canadians (and indeed first people anywhere) to own a Surface tablet running Windows RT.  Here is the experience of getting there in his own (largely unedited) words. –MDG

(The original post can be viewed on Sean’s personal blog at

Microsoft Rises Above With Microsoft Surface and Windows RT.

Microsoft PopupSo what was the morning like? On October 26th I had a crazy day.

The Microsoft Surface PC was being released, and I NEEDED and WANTED one for a presentation I was doing that week.

Hopping on the first train from my home to the Eaton Centre in Toronto, I rushed to find the Kiosk.

Oh and I did, the logo stood out calling to me….

“Sean! Run here!” Run I did thinking there would be a limited supply. I was all prepped up in my nerdiest of gear! MVP Scarf at the ready!

But Microsoft ensured stock was APLENTY.

“Do you have any Surfaces?!” I burst out at one of the first reps in line, almost knocking him down with my vocals (Those of you who know me, know that can happen)

“Surfaces? Absolutely sir! We have plenty! Tons! Which would you like?”

“32GigabyteWithAKeyboardIfYouPleaseButIfYou-Don’tThat’sOkCuzIJustNeedOne” the words burst out of my mouth in a rapid blast of syllables.

Do you remember the Squirrel from “Hoodwinked?” *I* was the Squirrel.(MDG Note: I do not know this reference)

I stood in line and looked.

With about two hours to go, a line was building. A hundred strong and growing by the minute.

It was a line full of executives, enthusiasts and even a few Mac users! I was blown away!  I was shaking like a leaf.

I kept thinking in my head “Faster! Faster! I need one of these in my hands NOW! Surface! Surface! Surface!”

There was some hooting and hollering along the way and oddly enough there were wagons full of candy bars.

But I wouldn’t move a micrometre from the line. I wanted my Surface and would not allow my own grumbly stomach to delay that. We nerds have our priorities don’t ya know ;) (MDG Note: Although Sean was born in the USA, this is a very common down-to-earth Canadianism, often heard in Saskatchewan and Nova Scotia).

After about FORTY minutes I found myself staring at the counter moments away from the Surface.  Live production models were on display, sexily toying with my emotions.

But in a very short while I would be standing in front of the Register, a dream being realized; I would own a real Microsoft tablet PC.

The transaction occurred.

One 32gb Microsoft Surface with keyboard combo and a VGA extension to run off projectors.

“I own a Microsoft Surface.” The words barely left my lips moments before a large “W0000000TTT!!!!” shattered the air.

I think some of the staff in the kiosk fell back from the shockwave.

I DID warn them I was the Energized Tech…

I do believe I scared most of the people at the Microsoft Kiosk, marketing people and possibly a few mice running about as I stood proudly at the top of the stairs and announced

“Ladies and gentleman! I hold in my hands, THE FUTURE! I HAVE THE POWER! W000000ttt!”

There was applause over that. The Microsoft people seemed to enjoy getting a bit of praise. It’s nice to feel a job well done.

I hold it in my hands now and realize I am holding something truly different.

It is a device that is as portable as a current tablet device and yet just a bit more.

It’s Windows 8 computer that is slim, powerful and capable of running my presentations, allowing me to blog and have a little fun at once.

But best of all, a system with the same user experience as my full-fledged desktop version of Windows 8.

I can finally have a portable device that works the SAME as my desktop with very few differences.

I can attach data from my BitLocker-encrypted USB memory kit, pull files of my MicroSD, and print if needed.

I can leverage the power of Microsoft Word, PowerPoint and Excel because they are built right in!

I can (and am doing so at this very moment) attach a full sized display and USB keyboard/mouse to my Surface and use it just as if it were a real PC.

Because when you get right down to it? That’s just what it is.

This entire blog post was composed and edited with Microsoft Word 2013 on my Microsoft Surface RT…

and I personally LOVE IT!

Sean The Energized Tech MCTS, MVP Windows Powershell Charter Member Springboard Technical Experts Program

The Haikus continue–You are getting in on it!

Following my first two published haikus on Windows Server 2012, I got my first couple of submissions from you!  Sean Kearney, Canada’s foremost PowerShell MVP and overall enthusiast, sent me a few poems of his own.  Here is the first, with two more coming (thus far, and for those of us who know Sean, there will be more!)


Manage remotely
Server without a GUI
Patch less and play more

Get on the Bus!

For the third year in a row the Springboard Bus Tour will hit the road leading up to TechEd.  If you have never met the bus you are missing out, because it delivers expert advice, great learning, and huge career benefits to IT Pros.  It delivers answers to questions you may have been having about desktop deployment, virtualization, managing consumer-devices in the office, cloud solutions such as Intune and Office 365, Application Compatibility, and much more! MSW-Tour-CityBanners

This year I am very excited, because my city (my adopted city, really…) has been chosen as the launching point!  That’s right, on May 2nd we will be taking over the MaRS Centre, South Tower at 101 College Street in downtown Toronto, CANADA!  (Yes, I know there’s a typo on the registration page… we’re fixing it!

So if you live in the Golden Horseshoe – or really anywhere from London to Kingston, Buffalo to Orillia, come join us for a great day of Windows 7, Office, MDOP, and more!

REGISTER NOW and save your seat for this free day of technical demos, Q&A sessions, and real-world guidance from Microsoft experts. We’ll see you on the road… and make sure to come say hi to me, Sean, and the rest of the STEP MVPs!

Oh, and remember… if you are not in or around Toronto, the Springboard Series Tour Bus is making stops in Detroit, Chicago, Indianapolis, Dallas, and Columbus… so you still have a chance to catch up and learn!


The Student Has Become The Master!

Monday evening I attended the monthly user group meeting of the Wellington Waterloo IT Pro User Group ( in Kitchener, Ontario.  The topic for the evening was called Windows 7 Deployment as presented by Sean Kearney (yes, THE Sean Kearney, a.k.a. The Energized Tech, a.k.a. (the former) Friday Funny Guy!) from SWMI Consulting Group and  The title of his presentation was ‘Busting the Myths: There is no simple way to upgrade from Windows XP to Windows 7.’  It was a great presentation… for a couple of reasons. 

In truth I know this presentation cold because I have presented it dozens of times… I brought it to Canada (it was originally a TechEd session done by Jay Ferron, Jeremy Chapman, and friends) for TechDays Canada, and have since presented it to dozens of audiences.  However to sit through it as presented by my colleague, who ‘learned deployment at my knee’ was great, to see not only that he really did get it, but also took my presentation, and truly made it his own.  It was great.

I have been working with Sean for a few years, and watching him evolve from the Friday Funny Guy into the Energized Tech has been great.  He truly has come a long way, to the point that I am willing to (and proud to!) have him represent my company, knowing that my reputation is at stake!

I met Sean about the same time that I met another good friend, Jacqueline Hutchinson.  At the time – early 2007 – I was visiting Toronto, and Jacqueline had recently taken over the president of WWITPro.  The group had been dropped in her lap, and she was doing her best to keep it going. Rick Claus asked me to spend a few hours with her and her team.  We sat down over Mongolian cuisine, and I gave them whatever wisdom and guidance I could.

Whatever challenges that user group leaders encounter (and there are plenty!) the greatest challenge to most groups traditionally has been what happens when the leader leaves.  Most groups are founded by people with strong personalities, and when they leave the void created has more often than not been the downfall of most groups that have tried.  To visit WWITPro, five years and three leaders later, and find it alive and well and thriving is really a testament to the power of community.

To be clear, I did not come to Waterloo to support Sean… he doesn’t need it; he knows his stuff, and does not need to be propped up.  I came to watch and enjoy (and deliver goodies and prizes from Microsoft and HP!), and to show my ongoing support for the IT Pro community in Canada.

I want to thank Sean for being such a huge community resource; he is a credit to his company, to the Microsoft MVP program, and to the Springboard Technical Experts Panel (STEP).  I also want to thank Terry Edwards, who stepped up and took over the group when it would have been just as easy to hope someone else would.  Being a user group leader may have its rewards, but it is also extremely taxing and demanding – and takes a huge chunk of time from their personal life.  Thanks Terry, and the rest of your team whose names I wish I knew to list here.

Oh… and thanks for the pizza!