Monday, August 11, 2008

Benp's Guide to Stuff : Scripting Hyper-V with WMI and PowerShell: Part 1 – Introduction + Querying State

 

Scripting Hyper-V with WMI and PowerShell: Part 1 – Introduction + Querying State

Scripting Hyper-V with WMI and PowerShell

Part 1 – Introduction + Querying State

Introduction

When it comes to scripting Hyper-V there are really 2 methods:

1. Using the virtualization WMI provider that ships with Hyper-V.

2. Using the cmdlets provided by System Centre Virtual Machine Manager 2008

So which option should you use? Well if you want an easy life, the answer is absolutely Option 2. Use SCVMM 2008, and scripting Hyper-V is like a pleasurable dream. The cmdlets are task orientated, provide a rich set of features and really do work very well. So why is this a guide to Option 1 – Using the virtualization WMI provider? Well, sometimes Hyper-V will be used without an accompanying System Centre deployment, and if that’s the case, using WMI is your only scripting option.

I`ll be honest, using the WMI provider to script Hyper-V is unintuitive, complicated and feels quite clunky. So the question has to be asked “Why is the Hyper-V WMI provider so difficult to use?” The answer is Industry Standards. The virtualization WMI provider fully complies with the standards outlined by the Distributed Management Task Force (DMTF). Whilst standards are great for creating consistency among different vendors, there are often comprises with the simplicity of individual solutions. Contrastingly the SCVMM cmdlets are a bespoke solution designed by Microsoft to be simple, intuitive and powerful, but do not adhere to any industry standards.

So, with the expectation that the Hyper-V WMI journey will be a challenging one, let’s get on with it.

...

Read full article for details and code ..

...

Benp's Guide to Stuff : Scripting Hyper-V with WMI and PowerShell: Part 1 – Introduction + Querying State

No comments:

Blog Archive