XenServer: Drivers for WinPE

Intro

If you deploy images with a Microsoft product, you are using WinPE (Microsoft Windows Preinstallation Environment) to configure and install an operating system. If you use XenServer for your Hypervisor of choice, then you will have to extract the XenServer drivers to import into your WinPE

Extracting the Files

The simplest way to get the files is to load the XenTools ISO onto a system and copy the install files over to a temporary location. Select your Virtual Machine, click the Console tab and select the DVD Drive drop down and select guest-tools.iso. In this case, my XenServer environment is on version 8.1.

This will mount the current XenServer tools ISO onto the virtual machine’s DVD drive.

To get the drivers, copy managementagentx64.msi (and managementagentx86.msi if you need drivers for a 32-bit operating system) to a temporary location on your system.

Here, we have the managementagentx64.msi file in the D:\temp folder. To extract the files we run the following command:

msiexec.exe /a managementagentx64.msi /qb TARGETDIR="D:\temp\drivers"

This runs installs managementagentx64.msi as an administrative install. This is why we used /a as a parameter and the TARGETDIR parameter so it will expand the MSI files into the D:\temp\drivers folder. I also used /qb to run the install in Quiet mode with a Basic GUI.

After running this command, we can now drill-down into folders created by the administrative install.

The MSI contains a lot of files and executables, but we’re looking for drivers. Fortunately, there is a Drivers folder. Under Drivers there are v8 and v9 folders. v9 holds the newer drivers. Under v9 we have the folders that contain the driver files (both 64-bit and 32-bit versions).

Importing the Drivers

There are five drivers that we will want to import into WinPE. In the following examples, I’m importing the drivers into Microsoft Deployment Tool.

I drill-down to my Deployment Share (MDT Production), expand Out-of-Box Drivers and right-click on WinPE 5.0 x64. The Import Driver Wizard start and we can drill down to the location of our drivers.

Click Next, Next and the import will begin. At the end a Confirmation window will display the status.

Since I didn’t drill down into each driver folder, the wizard imported both the 32-bit and 64-bit versions of the drivers. I can delete the 32-bit versions by selecting them, right-clicking, and choosing delete.

Now to use the new drivers, you right-click on the Deployment share and select Update Deployment Share.

The Update Deployment Share Wizard comes up. My preference is to always choose “Completely regenerate the boot images.” This takes longer, but the results are consistent.

The wizard will complete and a new ISO is generated in the Boot folder under your deployment share.

You copy this ISO to your XenServer ISO share, and when you want to build a new image, you point your XenServer virtual machine to this ISO and WinPE will use the new drivers you imported.

I hope this post helps you track down the XenServer drivers you need to automate builds in the future. Please comment if you have any questions.

Thanks for reading,
Alain Assaf

PowerShell: XenServer Count Function

countvoncount

Intro

I’ve been hesitant to dive into XenServer PowerShell cmdlets, but there’s no rational reason to not do it. Citrix continues to make great strides in expanding and updating PowerShell for XenServer, PVS, and XenDesktop. Today, we’ll go over a function that queries an array of XenServer Poolmasters and returns the total VM count on each. The idea behind this function was to stop manually counting VM’s in XenCenter and to understand VM growth and XenServer Pool utilization.

NOTE: Thanks to The Scripting Frog for getting me most of the way there with this function.

xenservercount
The manual count of VM’s

XenServer and PowerShell?

It may seem weird to use PowerShell to perform queries of a Linux-based system, but such is the world we live in. I remember back in my day :). Apple was a joke, IBM ruled the PC market and Linux didn’t exist. Of course I still remember saving BASIC programs to a cassette deck.

th

The script will prompt for credentials which can be root or any XenServer administrator. Then you connect to each pool master in turn…

The important flags are -SetDefaultSession and -NoWarnNewCertificates. You must set the default session on each new XenServer connection, otherwise, the script will not know what pool master to query. The NoWarnNewCertificates flag prevents a prompt asking you to accept the new XenServer certificate (you can leave this out if you want this additional warning to let you know you’re connecting to a new XenServer).

Unless you can refer to your XenServers with a DNS name, you can do some quick translation to make your output more readable. I’m using a switch statement to replace the IP address with a XenServer name.

The rest is just getting all the VM’s (minus snapshots, templates, etc), counting them and putting the results into a custom PowerShell Object. Finally you disconnect from each XenServer and go to the next one.

The results…

XenServer VM Count
--------- --------
XenServerPool1 108
XenServerPool2 109

You can get this and so much more from my github.

Thanks for reading,
Alain Assaf

XenServer: Change Root Password

keep-calm-and-change-your-xenserver-password-3

Intro

Your boss comes to you in a panic about security and passwords. You sip your coffee and calmly let her vent. You assure her that yes, you can quickly and easily change the root password on all your XenServers. She walks away confident you know what you are talking about.

Change that password…or can you?

You hit the Internet for information on changing the XenServer root password and are hit with article after article about recovering a lost root password. That doesn’t apply to you. You have your root password safely stored in your password store (right :)).

You ask yourself, “Self, where are the instructions on changing the root password when you already know it?

A quick look at the XenServer install guide and admin guides don’t reveal anything either.

Yes you can

Citrix support wasn’t much help in this, but the answer is quick and easy, especially if you have XenServer pools.

First connect to your XenServer (use the Pool Master if you have a pool), and get to the console.
xenserver1

Select Authenticationxenserver2xenserver3

Select Change Passwordxenserver4

Authenticate with your current password (if prompted).xenserver

Enter the old password, followed by the new password twice.xenserver7

Once you hit enter, the system will change the password.xenserver8
And you’re done.xenserver9

BONUS: If you changed the password on the Pool Master, this will change the root password on all the pool member servers.

Thanks for reading,
Alain