Virtualization

Installing Centos in Windows 2012 R2 Hyper-V

I need to create a virtual machine with CentOS 6.5 as the guest OS.

 

I clicked through creating the VM and discovered that the install wouldn’t work. Eventually tracked down the issues.

 

Keep the following points in mind as you create your VM:

  1. Create the VM as a generation 1 virtual machine
  2. Ensure the virtual disk controller and disk are IDE
  3. Ensure a legacy network adapter is used – may need to create the VM without a network adapter and add the adapter before the install
  4. If asked to test the install media (iso image) be aware that it will be ejected after the test so you’ll need to open it again
  5. keep it simple and only have 1 network adapter
  6. Use the map to find the nearest city to get the time zone – scrolling though the list is boring

Creating Virtual machines #1: Creating the VM

I’ve had two projects in mind for a while.  First I need to build a new WSUS server in my virtual environment & secondly I want to automate as much of the VM creation and configuration as possible. Oh – and I’m not using SC Virtual Machine Manager. 

I’ll be using the Hyper-V cmdlets that come with Windows 2012.

I covered some of this in PowerShell and WMI but that was for Windows 2008 R2 and I was using James O’Neills hyper-v functions. 

Does it get any easier with the cmdlets

This is what I came up with

function new-virtualmachine {            
[CmdletBinding()]            
param (            
 [parameter(Mandatory=$true)]            
 [string]$name,            
             
 [parameter(Mandatory=$true)]            
 [string]$path,            
 [Int64]$mem = 4GB,            
 [string]$vswitch = "Local Area Connection - Virtual Network",            
            
 [ValidateSet("Windows2012", "Windows2008R2", "Windows7")]            
 [string]$iso,            
            
 [switch]$startvm            
)            
            
Write-Verbose -Message "Testing VM Path"            
$vpath = Join-Path -Path $path -ChildPath $name            
if (-not (Test-Path -Path $vpath)){            
 New-Item -Path $path -Name $name -ItemType Directory            
}            
            
switch ($iso){            
 "Windows2012" {$isopath = "C:\Source\Windows 2012 RTM\en_windows_server_2012_x64_dvd_915478.iso"}            
 "Windows2008R2" {$isopath = "C:\Source\Window 2008R2\en_windows_server_2008_r2_standard_enterprise_datacenter_and_web_with_sp1_x64_dvd_617601.iso" }            
 "Windows7" {$isopath = "C:\Source\Windows7 RTM\en_windows_7_ultimate_x86_dvd_x15-65921.iso"}            
}            
            
New-VM -Name $name -MemoryStartupBytes $mem -Path $vpath -BootDevice CD -NewVHDPath "$vpath\$name.vhdx" -NewVHDSizeBytes 120GB -SwitchName $vswitch            
Add-VMDvdDrive -VMName $name -Path $isopath            
            
if ($startvm){Start-VM -Name $name}            
}


The new VM name and path are mandatory, I’ve set a default memory size of 4GB  and added a default Virtual switch. I’m adding the iso file containing the OS I want to install – that’s constrained by the set validation and I have a final parameter that allows me to start the VM.



if the path in which I want to create the VM doesn’t exist I create it.



A switch statement is used to set the full path to the iso file.



The New-VM cmdlet is used to create the VM based on the information provided.  I do hard code the fact that I’m setting the VM to boot from the CD and that the virtual disk will be 120GB



Add-VMDvdDrive is used to add the DVD drive to the VM (the controller location is automatically worked out) and the iso file mounted.



If the startvm switch is used then the VM starts and OS install commences. I’m deliberately NOT automating the OS setup at this time – that may be another project.

UK PowerShell Group–November Recording

The November meeting

http://msmvps.com/blogs/richardsiddaway/archive/2011/11/05/powershell-user-group-22-november.aspx

was “What’s new in PowerCLI 5?” presented by Jonathan Medd

The recording of Jonathan’s presentation is available from

https://skydrive.live.com/?cid=43CFA46A74CF3E96&id=43CFA46A74CF3E96%212929

Jonathan’s slides are available from

http://www.jonathanmedd.net/2011/11/whats-new-in-powercli-5-0-slides-from-uk-powershell-usergroup.html

 

Enjoy

UK PowerShell Group November–reminder

UK PowerShell Group meeting – Jonathan Medd on “Whats new in PowerCLI 5”

details from http://msmvps.com/blogs/richardsiddaway/archive/2011/11/05/powershell-user-group-22-november.aspx

Networking pains

Last week my wireless router decided that it had enough and wasn’t going to work any more. This was annoying because I was due to give a user group presentation that night.

I got a new router up and working but today discovered that connectivity from my Hyper-V environment wasn’t working. With the previous router I’d configured bridging between a Hyper-V virtual network and the wireless adapter in my host. That had to be recreated at which point I discovered that the new router didn’t want to support bridging.

I ended up using RRAS and NAT to get the connectivity. The instructions I found here

http://sqlblog.com/blogs/john_paul_cook/archive/2008/03/23/using-wireless-with-hyper-v.aspx

provide most of what you need.

Remember to set the default gateways and DNS servers properly for it all to work.

PowerShell and VMware book

My good friends Jonathan Medd and Alan Renouf (together with a number of co-authors) have just had their book “VMware vSphere PowerCLI Reference: Automating vSphere Administration” published. More details on the book contents and for a chance to win a copy visit

http://www.jonathanmedd.net/2011/03/powercli-book-raffle.html

I’ll doing a full review of the book when I can get my hands on a copy

Lenovo W510, Hyper-V and BSOD

Beginning of the week I took delivery of a Lenovo W510 – i7 quad core with Hyper-Threading (Windows sees 8 cores) and 16GB of RAM.  From reviews I’d seen it seemed to run Hyper-V OK so it fitted the bill for a mobile lab.

Partitioned the disk OK and got Windows 2008 R2 installed.  Had to download a few drivers from the Lenovo (IBM) site but everything I needed was there or on the box already.  I’d ordered it with Windows 7 64bit so most of the drivers were available.

Installed Hyper-V and joined it to the domain.

Started moving Virtual Machines on to it and it started crash with a Blue Screen of Death.  Not good & I’m not amused at this point. Eventually got to the point where it wouldn’t start – continual BSOD.  Very not good – my new toy is going back if this continues!

Did some research and it seems there can be a conflict between core parking and Hyper-V.  Core parking is a power saving technology that puts cores to sleep if they are not being used. Hyper-V expects them to be there = BANG.

I booted into the BIOS screen and disabled the power management features on the CPU (and PCI bus for good measure) that enable core parking.  Restarted and everything now seems OK.

I can comfortably run a bunch of VMs and have a reasonable performance. 

Then I discovered that I had to reactivate Windows on all the VMs.  They’d been originally been running on a machine with AMD processor. New processor is Intel.  Its enough of a change to trigger reactivation.

All done and everything seems to work fine.

Time to get Virtual Machine Manager installed and see what that actually does.

Book review: Managing VMware Infrastructure with Windows PowerShell

Author: Hal Rottenberg

Publisher: Sapien Press

ISBN: 978-0-9821314-0-4

If you’ve not read one of my reviews before I have three main criteria for judging a book:

· Is it technically accurate?

· Does deliver the material it claims to deliver?

· Is worth the cost of purchase and the time I spend reading it?

This is a relatively short book at 359 pages

After an Introduction the book is divided into the following chapters:

1. Windows PowerShell Crash Course

2. Getting Started

3. Scripting with Virtual Interface

4. Inventory and Reporting

5. Deployment and Configuration

6. Maintenance and Operations

7. Troubleshooting and problem resolution

An appendix deals with Managing VMware with PowerGUI. I haven’t got into this yet as I still prefer running scripts. I will probably end up creating a PowerGUI powerpack of them for use at work – sorry these can’t be shared.

This may seem like a short list but there is a massive amount of information packed into these chapters. The book is written using PowerShell 1.0. I’m running the VI Toolkit on PowerShell 2.0 against vsphere 4. It all works. The toolkit enables us to perform tasks against the host and the guests in a virtual environment.

Chapter 1 is an introduction covering installation, configuration and the key features of PowerShell such as the pipeline and key cmdlets. Chapter 2 is a very short chapter that introduces the VI Toolkit and the PowerShell cmdlets for VMware.

In chapter 3 we start to look at PowerShell scripts and how the VI Toolkit works with PowerShell. The contents of chapters 4-7 are explained by their titles. I found the information in these chapters to be useful and accurate with the examples ready to use.

Judging against my criteria:

· Is it technically accurate? From a PowerShell aspect yes it is. From a PowerShell aspect everything I’ve tried works as described so again I have to give 10/10 for technical content.

· Does it deliver the material it claims to deliver? Oh yes. I found the examples easy to use and they work. It shows how to use PowerShell against VMware. 10/10

· Is worth the cost of purchase and the time I spend reading it? Very definitely. Its already saved me the purchase price several times over and I’m just on the Inventory and Reporting chapter! This very definitely is a book that repays reading – 10/10

The index is will put together as I was able to find everything I needed. Overall score has to be 10/10.  This is one of the best books I’ve bought in a long time.

Before we get too carried away I think the typesetting could have been better – the headings don’t always stand out on the page which can make following the chapters a bit difficult in some places – that’s the only negative I can find.

I haven’t had any need to delve into VMware in any detail until just recently but I did try out the VI Toolkit when it was first in beta. This book is my way into the bits of VMware I need. If you are working with VMware and use PowerShell you should have a copy of this book. If you don’t you should go an buy one – now.

HA and DR book

The first chapter of my latest book for RealTime Publishers is available for free download. The title is The Shortcut Guide to Understanding the Differences Between High Availability and Disaster Recovery.

Download from http://nexus.realtimepublishers.com/sgudb.php

Book review: Practical Virtualization Solutions

I’ve just published a review of this book

http://itknowledgeexchange.techtarget.com/powershell/practical-virtualization-solutions/

Its a good general introduction to the whole virtualisation story with some interesting points to make.

Technorati Tags: ,