Monday, 17 March 2014

Using Hyper-V on Server 2012 R2 under VMWare Workstation 9

I am still running VMWare Workstation 9, as I got a license to use it when I passed my VCP 510 exam, and haven't yet found anything it cant do.

I recently thought I might do at least one Windows Server 2012 exam, and as I specialise in VMWare Virtualisation, I thought I'd have a look at the 70-410 exam which includes a piece on Hyper-V.

The Hyper V role doesn’t want to play nicely on my laptop with VMWare Workstation installed, so I thought I would create a Windows Server 2012 R2 VM and try to get HyperV working on that.

I soon found that trying to install the HyperV role on a Windows Server 2012 VM, without the below tweaks performed, will provoke the error "Hyper-V cannot be installed: A hypervisor is already running."

To get around this, right click on the VM in Workstation, and choose settings. Select Processers then select;
"Virtualise Intel VT-x/EPT or AMD-V/RVI"
Also, set the Virtualisation Engine preferred mode to "Intel VT-x/EPT or AMD-V/RVI".
Click OK.

Finally, edit the vmx file in notepad (if you don’t know about VMX files, right click on the VM in workstation and choose settings, then click the Options tab and select Advanced. Highlight and copy the value in the "File Locations: Configuration" field, then hold the windows key and press r to bring up the Run dialog. Type notepad, then press space and insert the copied path, then press return).
Copy and paste the below line to a new line of its own, then save and close notepad.
hypervisor.cpuid.v0 = "FALSE"
*If you copy and paste the above, ensure the speech marks around the word FALSE are straight and not curved*


You can now power on the VM, and go to Server Manager to click "Add Roles and features". Tick the box next to Hyper-V, then click Next until you can click Install.

Monday, 3 March 2014

Quick VM report - IPs and (vcloud vapp or VM folder)

Its been a while since I blogged anything, so even though this isn't much to write home about, the end of my project and therefore the need for a new job has inspired me to blog this :)

Today I needed to get a list of all VMs in a VDC (which translates to vsphere as a resource group).

The resource group name is hard-coded below as CHANGME, so you need to update this ;)

ipreport.ps1 begins;

#Connect to vcenter
connect-viserver

#create a report shell
$table = @()

#GetVM Name and IP address
get-resourcepool CHANGME | get-vm | foreach {

#Create row
$vminfo = "" | select-object Name,IPAddress,vapp
#Populate row's column with VM name
$vminfo.name = $_.name
#Populate row's column with IP address
$vminfo.IPAddress = $_.guest.extensiondata.IPAddress
#Populate row's column with vapp name
$vminfo.vapp = $_.folder
#Commit row to the report
$table += $vminfo
}

#Pipe report through a sort command, and output to HTML for easy reading
$table | sort-object -property IPaddress | convertto-html -title "IPs for VMs" > C:\scripts\ips.html