26/11/2008

What is WQL and how to use it

The SCCM / MDT Task Sequence Editor lets you specify "conditions" under which particular Tasks can run.
One of the conditions that can be used is a WQL query.

This post explains what WQL is and how to use it.

What is WQL
WQL stands for "WMI Query language"
WQL is a subset of SQL and can be thought of as "SQL for WMI"

Why use it?
Having the ability to run a task based on a WQL query is incredibly powerfull.
This means you can cause something to happen (or not happen) based on the result of a WMI property.

e.g
You may want to run a driver package only on specific types of hardare
Whilst a common scenario, it's not "obvious" how to create and test a WQL query when starting from scratch.

Creating and testing with WQL
The Task sequence editor dosn't provide any help with constructing or testing a WQL query, so (to avoid pain and dissapintment!) it's best to TEST this using another tool before using a WQL query in a task sequence.

An easy way to do this is to use WBEMTest.exe

Using "Windows Management Instrumentation Tester" (WBEMTest) to validate a WQL query

  • run WBEMTest.exe
  • Select "Connect..."
  • Enter root\cimv2 (instead of root\default)
  • Select Connect

  • Select "Query..."

  • Start by entering a simple query
    e.g. SELECT * FROM Win32_Computersystem
  • Select "Apply" to run the query

  • You'll see a "Result" similar to the one below:

  • Double-click on the result to "drill-down" and have a look for some more "interesting" properties to query for!
  • Scroll-down within "Properties" and note the value for "Model"
    (in my example this is a "ProLiant ML110 G5")

  • You can use these details to construct a more useful WQL query.
  • Go back to the query screen (Close,Close then Query)
  • Enter a query using the new values:
    SELECT * FROM Win32_ComputerSystem WHERE Model = "your model"

  • In my case this returns "1 objects". This means it's a "success"
    (i.e. will be evaluated as "True" if used within a Task Sequence)

What happens if a query dosn't evalue to True

  • Below is the output when looking for something that won't result in a match

  • Basically it returns "0 objects"
    (i.e. will be evaluated as "False" if used in a Task Sequence")


What happens if an invalid query is specified

This is likely to be a common scenario when "getting the hang of it" / testing.

Other Queries to try

Show all local accounts

  • SELECT * FROM Win32_Account

This can be easily "refined" to look for a specific account

  • SELECT * FROM Win32_Account WHERE Name = "FredBloggs"

Useful References

MSDN : WQL (SQL for WMI)

23/11/2008

Using MDT and SCCM to do an unattended install of Windows XP on ESX Server (1 of 2)

This post describes how to add VMware ESX drivers for an "OS Install Package" (aka "an unattended install") of Windows XP using MDT and SCCM.

The important point to note is that MDT can now handle "injection" of Mass Storage Drivers on Windows XP (not just Vista)
(i.e. it writes the correct entries to unattend.txt to support use of a 3rd party Mass Storage drivers, creates and populates the requires driver structure for this to work during an unattended install).

IMHO this is a "big deal" and means it's well worth investing time in understanding the "vagaries" of MDT and SCCM as it really can simplify OS deployment (once you know how to use it!)

Prerequites / Assumptions

Overview of Steps

  • Import (VMWare) drivers into SCCM
  • Create a new (VMWare) driver package
  • Add these drivers to your WinPE Boot Image
  • Edit the Task Sequence and add an "Apply Driver Package" Task (referring to the VMWare drivers package).
  • Enable the checkbox "Select the mass storage driver within the package that needs to be installed before setup on Pre-Vista operating Systems"
    (NOTE - the last two steps are the crucial pieces which make the "magic" happen)

Import (VMWare) drivers
Within the Operating System Deployment node in SCCM.
Right click on Drivers and Select "Import"

Point to the location where you've placed the VMWare driver files.
In my case I've stored driver files below file://sccm/Source$/drivers/vmware\Source$\drivers\vmware
(below this I have 2 subdirectories - \vmscsi - with the disk files and \vmxnet with the network drivers - these were obtained using the process descrived here)

The driver files should appear as shown below:


Create a new (VMWare) driver package

I've called my driver package "VMWare ESX"

Now select this as the package you want to add drivers to

Add drivers to the WinPE Boot Image
Select a Windows PE boot image to update (mine is called "Windows PE Custom")

Ready to let SCCM do it's stuff...


Progress is shown while it's being created...

Done - the drivers were imported, added to a new Driver package and the WinPE boot image was updated.

This is what the drivers looks like within the "Drivers" node.
(tip: in order for these to show up with SCCM you may need to select "Refresh")


and here's the new Driver Package we created...


Now for the really important piece (which needs to be manually added)

Edit the Task Sequence and Add an "Apply Driver Package" task
To inject a mass storage driver for Windows XP during the unattended install routine, you need to Add an "Apply Driver Package" task (pointing to the newly created VMWare drivers package). This must be added before the "Setup Windows and ConfigMgr" task.
To do this :
  • Edit your OS deployment Task Sequence
  • Set focus on a task immediately before the "Setup Windows and ConfigMgr" task.
    (In the screenshot below you can see I've focussed on "Auto Apply Drivers")
  • Select Add -> Drivers -> "Apply Driver Package"


Browse to the Package with the Drivers (in my example "VMWare ESX")

Enable the "Select mass storage driver..." checkbox

IMPORTANT
Select the box which says "Select the mass storage driver within the package that needs to be installed before setup on Pre-Vista operating systems"
(This takes care of driver injection during the unattended phase)


I'll describe what actually happens during the unattended install process and show the modified contents of unattend.txt and associated driver strucure in Part 2 of this post.

How to get drivers for an unattended install of Windows XP on ESX Server

When performing an Unattended install of Windows XP on ESX server, you need to obtain disk and network drivers to integrate into the unattended install.

One way to do this is to extract the files from the VMWare Tools file.

More Details:

Attach windows.iso to a working virtual machine (or mount using an iso mount tool)

Disk

Disk drivers are located below:

\Program Files\VMware\VMware Tools\Drivers\scsi\win2k
disk.tag
txtsetup.oem
vmscsi.cat
vmscsi.inf
vmscsi.sys

Network

Network drivers are located below:

\Program Files\VMware\VMware Tools\Drivers\vmxnet\win2k\32bit
vmware-nic.cat
vmware-nic.inf
vmxnet.cat
vmxnet.inf
vmxnet.sys

For more details about the default hardware options set when the Guest Operating is set to "Microsoft Windows XP (32-bit)", refer to my earlier post "Windows XP on ESX Server - Hardware and Drivers"

MDT and SCCM - How to get started

I'll be making a series of posts about:

  • Microsoft Deployment Tookit (MDT) 2008
    and
  • System Center Configuration Manager (SCCM) 2007

One of the first things anyone wishing to learn about these technologies will want to do is setup a lab environment.
The sheer number of components and dependancies can make this a daunting task!

Quick Start Guide
The best reference I've found on how to do this is "Quick_Start_Guide_for_Configuration_Manager_2007.doc"
This can be found within "Getting Started with MDT 2008 Update 1.zip" available in the download area for "Microsoft Deployment Toolkit Update (MDT) 2008 Update 1".


The doc contains information on:

  • Pre-requisities (Software and Infrastructure)
  • How to setup the pre-requisite Infrastructure
  • Preparing the MDT Environment
  • Importing and Creating a Task Sequence to Create a Reference machine
  • Deploying Vista and capturing an image of a Reference Machine
  • Importing and Configuring a Task Sequence to Deploy a Target Computer
  • Deploying a Captured Image from a Reference computer onto a Target computer

This doc is ESSENTIAL reading as a first step.

Personal Observations on the Document

Sadly the document dosn't contain pictures, is lengthy (48 pages), and despite containing individual steps, is (IMHO) not easy to follow.

I'm a huge fan of pictures (to quote a cliche "a picture paints a thousand words") and am convinved it's possible to convey this (vital) information in a much more "digestable" form. However (for now), trawling through this doc seems unavoidable to achieve a working environment and understand the "intricacies" of MDT and SCCM "integration".

Windows XP on ESX - Manually installing disk drivers

Within this post I describe how to install the VMSCSI (BusLogic) driver during a manual installation of Windows XP.

The steps are as follows:

  • Create a new virtual Machine
  • Specify Guest Operating System Type as "Microsoft Windows XP (32-bit)"
  • Edit Settings to attach a .iso with Windows XP on it
  • Power on the machine
  • Press F6 when you see the message in the screen below
    (Note : you don't recieve immediate "feedback" to let you know your key press has registered!)

  • If F6 has been pressed at the correct point, a few moments later, you'll get another screen allowing you to specify drivers
  • "S=Specify Additional Device". Press S.

  • Another screen appears prompting for the "Manufacturer-supplied hardware support disk"

  • At this point, Edit VM Settings and attach a floppy image with the VMSCSI drivers on it.
    (Typically you can locate this within the ESX datastore e.g. /vmimages/floppies/vmscsi-1.2.0.2.flp)
  • Make sure the status is set to "Connected"
  • Press ENTER to contine.
  • "VMWare SCSI Controller" should be shown, press ENTER to select

  • Another screen will appear showing the selected driver

  • Confirm it says "VMware SCSI Controller" and press ENTER to Continue

Job done! - the remainder of the Windows XP installation should continue as normal.

What happens if F6 is not pressed

If F6 was not pressed in time, you'll recieve a message saying "Setup did not find any hard drivers installed in your computer"

What happens if the wrong driver is specified

If the wrong driver is specified, you're likely to recieve a STOP 0x0000007B error indicating an Inaccessible Boot Device.

Windows XP on ESX Server - Hardware and Drivers

When "Microsoft Windows XP (32-bit)" is selected as the Guest Operating System on ESX server, the default hardware devices that get created are as follows:


From an OS install / deployment perspective, the most significant items are disk and network.

Windows XP dosn't ship with drivers for the BusLogic adapter, so drivers must be specified either during a manual install (F6) or integrated into an automated setup routine. I've described this process in seperate posts:

Hardware Details
For reference I've listed the hardware details and drivers that are used on Windows XP.

DISK:
Name : VMware SCSI Controller
Manufacturer : VMware, Inc.
PNP Device ID : PCI\VEN_104B&DEV_1040&SUBSYS_1040104B&REV_01\3&61AAA01&0&80
Driver : c:\windows\system32\drivers\vmscsi.sys

Network :
Name : VMware Accelerated AMD PCNet Adapter Adapter
Device ID : PCI\VEN_1022&DEV_2000&SUBSYS_20001022&REV_10\3&61AAA01&0&88
Driver c:\windows\system32\drivers\vmxnet.sys


Device Manager View
Once installed, this is what it looks like in Device Manager:

VMWare ESX Server, "Guest Operating System" and .vmx files

In ESX Server, the "Guest Operating System" must be specified when creating a virtual machine. This results in certain (virtual) hardware components being used.

Guest Operating System as shown by the GUI


Virtual Machine Hardware Properties
The screenshot below shows the Hardware properties applied after selecting "Microsoft Windows XP Professional (32-bit)" as the Operating System.


Virtual Machine Configuration File ".vmx"
Virtual Machine configuration details are stored as a file with a .vmx extension. These are simply text files with specific fields that define the virtual machine configuration.
Relevent entries for the configuration above are shown below:

22/11/2008

Purpose of this blog

I setup this blog to:
  • Act as an on-line reference for topics I'm interested in
  • Provide a way of sharing information

Topics / Areas of Interest I plan to cover are:

  • Virtualisation (VMWare, Hyper-V, App-V, VDI, XenDesktop etc)
  • Operating Systems (Windows XP, Windows 2003/2008)
  • Systems Management and OS Deployment (SCCM, MDT)
  • Application Deployment