Wednesday Tidbit: Shutdown your lab with one click

20150713 - PowerCLIRecently I’ve found myself having to shutdown my home lab quite often as the weather has been better than expected and the temperature has risen dramatically.  Great for sitting in beer gardens, not so good for the lab.

To speed up the process of shutting down all my VMs (currently 68 of them) I decided to knock up a very simple PowerCLI script:

# Variables

$esxi = ""
$credential = Get-Credential

Connect-VIServer $esxi -Credential $credential

Get-VM | where {$_.Powerstate -eq "PoweredOn"} | Shutdown-VMGuest -Confirm:$false

Start-Sleep -s 600

Stop-VMHost -Confirm:$false -Force:$true

Disconnect-VIserver $esxi -Confirm:$false

Definitely not rocket science, but the greatest scripts don’t always have to be complicated.

There are a lot of other devices (storage and networking equipment) that also have to be scripted to shutdown, but this is a start.

Building an advanced lab using VMware vRealize Automation – Part 3: Physical infrastructure – networking

20150630 - vRAIn part 2 we outlined our storage resources for the project.  We built a Windows 2012 R2 Server which provided iSCSI and NFS services to the environment.

In this part we configure the networking infrastructure that has been provided for the lab, and prepare it for the introduction of our VMware ESXi hosts.  Continue reading

Building an advanced lab using VMware vRealize Automation – Part 2: Physical infrastructure – storage

20150630 - vRAIn part 1 I outlined the aims of the project, which is to build an advanced lab using VMware vRealize Automation.  In this article, we will configure the storage that will house our provisioned virtual machines.

The first constraint that has been identified is cost, which effectively rules out fibre channel storage of any kind.  However, with the right hardware, we can utilise other technologies such as iSCSI and still provision high-performance storage: Continue reading

Wednesday Tidbit: Create custom ESXi ISO with ESX-tools-for-ESXi

20150713 - PowerCLIMy test cluster in the lab recently needed to be rebuilt.  As this cluster is nested and I wanted the latest version of ESXi to be deployed, I thought it would be good to use Image Builder to combine the two.

After downloading the VMware Tools for Nexted ESXi tools fling, I followed Andreas Peetz’ article on how to use them to build an offline bundle.

Once done, I used the following PowerCLI script with Image Builder to create my new ISO complete with VMware Tools for Nested ESXi:

# Add VMware depot
Add-EsxSoftwareDepot C:\Depot\

# Clone the ESXi 5.5 GA profile into a custom profile
$CloneProfile = Get-EsxImageProfile ESXi-5.5.0-20150504001-standard
$MyProfile = New-EsxImageProfile -CloneProfile $CloneProfile -Vendor $CloneProfile.Vendor -Name (($CloneProfile.Name) + "-virtualhobbit") -Description $CloneProfile.Description

# Add the Nested ESXi VMTools Offline bundle
Add-EsxSoftwareDepot C:\Depot\

# Add the esx-tools-for-esxi package to the custom profile
Add-EsxSoftwarePackage -SoftwarePackage esx-tools-for-esxi -ImageProfile $MyProfile

# Disable signature check

# Export the custom profile into an ISO file
Export-EsxImageProfile -ImageProfile $MyProfile -ExportToISO -NoSignatureCheck -FilePath C:\Depot\ESXi550-201505002-virtualhobbit.iso

I also chose to export the image profile to a .zip file, so I could use it to remediate an existing cluster using VUM.

Export-EsxImageProfile -ImageProfile $MyProfile -ExportToBundle -NoSignatureCheck -FilePath C:\Depot\