Thursday, January 23, 2014

Today I took my first exam of the year on Microsoft Server Virtualization and succeeded in getting a quite good score (942/1000). This earned me the certification "Microsoft Certified Specialist: Server Virtualization with Hyper-V and System Center".

My thoughts:

The exam itself was not too difficult: if you have at least some hands-on experience with the Microsoft System Center suite and if you already are (like me) a VMWare Certified Professional (VCP), you'll see that having a strong knowledge of all that virtualization is about helps a lot. As Brad Anderson explained on his blog last October, there is an increasing demand for Hyper-V experts, and being comfortable with Microsoft and VMWare platforms can boost your career.

I have learned a lot from the labs I made to prepare this exam, since the exam comes up with a lot of real life situations. Labs, labs, labs!

I am very happy to see so many Powershell questions on this exam, which confirms (if you didn't know) that my favorite administration language has become a central block of the whole Microsoft strategy

There are a few tricks in the wordings, and you may be miss-directed to points that are not essential to the question being asked, so be careful

The 2-days show by Symon (@SymonPerriman) and Cory (@holsystems) on MVA is your best bet to success, since they cover most of the exam topics

Friday, January 17, 2014

A few days are left before the start of the first noted event of the 2014 Powershell Winter Scripting Games. In the meantime I have decided to write a blog post on moving your first steps in a Windows Azure environment with Powershell. This can be particularly useful if you wanted to take part in the Games and still don't have an environment with Powershell 4.0 installed, since you can create a few Windows 2012 R2 VMs with the following quick steps.

As an introduction, know that in these times there is a growing interest for Cloud technologies and Microsoft has answered the need for outsourced infrastructures with the possibility to run your IT as a Service (IaaS) in its Cloud datacenters. Windows Azure is the name Microsoft gave back in 2008 to its Cloud application platform, which became available on February 2010.

Microsoft is offering a one-month free trial, so activate your subscription and download and install the latest version of Windows Azure Powershell, which is 0.7.2.1 at the time of writing.

At this point you don't even need to import any module since starting with Powershell 3.0 there is a module auto-load feature: so type the cmdlet you need and PowerShell will load the Azure module for you.

As a general information, the last version of the Azure module comes with 242 cmdlets. The most common nouns in this module are the following ones:

The next step is to configure Windows Azure Active Directory authentication in PowerShell with Add-AzureAccount (this is much easier than using the combination of Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile). For a basic usage, this cmdlet takes no parameter: it just opens a browser dialog box asking for the Microsoft Account that you registered to manage your subscriptions.

You can check that you have properly bound to your account with Get-Azureaccount:

Before we deploy a new test virtual machine, I want to make a short digression on the VM sizes you can choose from. There are eight possible sizes, starting from Extra Small to A7:

As you can see in the image above, Small is the minimum recommended size for a Production VM (and with the free trial you can run two of them for a whole month), while Large is the minimum for a SQL node.

Keep in mind that the daily cost for each of this virtual machine size is different, so plan accordingly to your budget:

Once the cmdlet ends, your VM is already available for use with the OS installed, RDP and WinRM enabled on their standard ports. Public ports for these services are also opened trough a Port Address Translation (PAT) mechanism.

Now, I haven't been succesfull in using the New-AzureQuickVM cmdlet againts an existing service. The cmdlet fails with the following error message:

"New-AzureQuickVM : ResourceNotFound: The deployment name 'existingcloud' does not exist."

It must be a bug, since in the cmdlet help it says that I can specify an existing service name:

-ServiceName
Specifies the new or existing service name.

So for the moment you have to stick to creating a new Service Name each time you run this cmdlet...

As a side note, I am deploying my VMs using 'West Europe' as location (The 'west europe' datacenter is in Amsterdam). Microsoft Public Cloud offers various possible locations and you should choose the one near to you:

It looks like operations like virtual machine provisioning or deletion keep an exclusive access on the deployment engine and don't allow for parallel virtual machine setup in the same Windows Azure environment. I haven't found a solution to this and that's sad because I liked the idea of deploying a whole IaaS in just one Powershell Workflow. But, I am sure the technology under the hood is making huge steps forward and I would expect such a feature like Powershell workflow to be fully leveraged in the first major release of the Azure module. Meanwhile we have to stick to serial execution of our VM provisioning, which is nonethless extremely trivial.

Performancewise, the rapidity of the deployment of a new VM in the Cloud is pretty stunning, with the vhd disks deployed in a bunch of seconds and the VM started in a couple of minutes:

That's all for this first post on Windows Azure and on the Windows Azure Powershell module. I hope you have found the subject passionating and in that case I hope you'll share it and give feedback. Stay tuned for more, and good luck with the Games if you're in (I hope you are).

Thursday, January 9, 2014

The Scripting Games have started and I am pleased to see that a few teams have already published interesting approaches to the first test event. Nonetheless I see that some people still persevere with some of the common mistakes beginners do.

In this blog post, I want to shed some light on two of these common mistakes.

The first one it’s not really a mistake but a bad habit. Let's see why. In the first test event you are asked to perform some quite complex computer inventory tasks. As you know, inventorying Windows-based computers generally passes through WMI queries through the use of the Get-WmiObject cmdlet:

Some people naïvely tend to remove returned objects from the pipeline using Where-Object cmdlet.

But, and this is very important, when you are retrieving many information from many distant servers, and piping the resulting objects to Where-Object, you could encounter performance problems due to the huge amount of data your station has to analyze and keep or discard.

The tip here (that Don Jones named ‘Filter Left’ in his training) is to make use of the –Filter parameter, which is available for many Powershell cmdlets:

There you go: unsurprisingly we get 200 milliseconds for –Filter versus more than 800 milliseconds for Where-Object.

Let me move on to the second mistake, which is not knowing that you have to explicitly set the value of the parameter -ErrorAction to Stop in your WMI queries if you want to trap errors using the Try {} construct.

This is because some exceptions returned by WMI queries aren't terminating errors.

For example, the following script returns a big red error message, like if the Catch {} block was skipped:

The major advantage of transforming your WMI errors in terminating exceptions and writing to the host nicely composed error messages is that you show that you master your code and that your scripts is designed well enough to cope with unforeseen issues.

Wednesday, January 1, 2014

The 2014 Powershell Winter Scripting Games are just about to start. I am proud to say that I have been selected by 2013 Scripting Games winner and Head Coach Mike F Robbins to act as an expert Coach for this edition and I will do my best to offer constructive feedback to all teams that post their script files to the Scripting Games website.

Here's a quick list of things you have to know and/or keep in mind during these Games:

Boe Prox does an excellent job of explaining the best way to make your code neat and clear, through the use of variable that make sense, proper error handling, and comment-based help. Check it out here.