PowerShell – It is frustratingly awesome!

As part of the service I’m providing to the client I’m working for, I’ve been developing scripts to both automate the initial deployment of ESXi (Unattended install), which has gone well and finished to the point it needs to be where a PXE boot environment sits on the LAN to automate the entire process from host server network boot to a standalone ESXi host existing on the network.  To follow on from this I opted to use PowerShell to provide follow-up configuration to that unattended phase.  This then expanded to configuring the vCenter server and auto-deploying VM’s.  A lot has changed about my scripts as I’ve learnt more about PowerShell and seen the trends used in writing PowerShell scripts from others on the Internet.

I’ve reached a point where my ESXi follow-on does as much as I need for now, but needs a vCenter in place first, so that has been a recent focus along with a deployment script (we are at a point where the client production environment needs VM’s so I had to escalate that one!).  I’ve really learnt a lot about PowerShell these last few weeks and am quite pleased with what my scripts can do as far as completing a lot of timely tasks in a matter of minutes.  In the case of the vCenter and VM deployment scripts, as I’ve developed them I’ve thought of more things I’d like them to do so it automated as much as possible and I’ve almost achieved a 100% VM deployment…I think!

The vCenter configuration script takes and empty vCenter server (newly deployed VCSA or Windows based) and populates the datacenters, clusters, resource pools, VM folders and vApps, whilst also setting the cluster HA/DRS and Resource Pool/vApps (to a basic level but has capacity to cover all values possible through PowerShell), all from a single CSV based database.  It makes a lot of checks to ensure objects can be created and values can be set to avoid errors, and can account for duplicate resource pool name across clusters when deploying vApps.  Folders are created in the right place and not in the ‘Hosts and Clusters’ window.  This has been enough to satisfy my need to deploy a production vCenter quickly and allow additional vCenter servers to be configured just as quick as and when necessary.

The ESXi follow-on script completes the customization of the host itself and joins it to the vCenter server, putting into the correct cluster.  There is a little more work needed here to eliminate hard-coded information but again, it is at the point where it does what I need easily and quickly.

The VM deployment script has been a challenging one as the VM’s will have 2x network adapters and some will have multiple disks.  The template is built with a single C: drive and configured as much as necessary with just one NIC.  Therefore I’ve had to figure out how to add disks during the VM build-out and then add additional adapters.  I also wanted to configure the 2nd NIC IP before the script finished and this was probably the most challenging part.  I have actually only finished this final piece of the jigsaw tonight and suffice to say, it works 🙂  The script itself uses another CSV file holding all critical details for each VM to be deployed.  The first phase sets up a unique copy of the Guest Customization Specification, configured in vCenter (I guess I could have created this with PowerShell too!) and applies the primary NIC settings which can then be passed to the VM during phase 2 which is to create the VM itself from the prepared template.  The VM placement is set and ensures the right cluster resource pool is used in the event duplicate names exist.  I’ve then added the second NIC ready for configuration later in the script because the VM hasn’t been powered on yet!  Phase 3 configures the CPU count, RAM, adds additional VMDK’s as necessary (applying the correct storage format), finally setting DRS Automation and HA Isolation Response/Restart Priority (if they are specified).  At this point the VM is powered on.  The final phase is to set the second NIC IP but the customization hasn’t completed yet so we need to wait.  The powered on VM will reboot itself approx. 2 minutes after first power-on to begin the customization and then reboot itself 1-2 more times before completing.  We really need to wait until that final boot before trying to set NIC 2’s IP.  Therefore I’ve put a loop in where I ping the VM’s custom primary IP (which won’t be active until customization has completed at which point we know the VM is ready).  Once a response is received there a further pause to allow the boot process to complete since the NIC becomes active prior to log-on ability (and we need to login to set the NIC), before PowerShell cmdlets are passed to the GuestOS with the local admin account to apply the secondary custom IP details.

That’s it!  To be honest, it doesn’t seem a lot to me but the challenge has been to learn and achieve it.  I don’t deny I’ve used the expertise of others from their Internet Blogs and forum posts to reach my goal but I can also say I’ve not found any one script out there that does all the things mine do, so I’ve had to use my brain to link everything together 🙂  My scripts are available @ https://drive.google.com/folderview?id=0B6F_8rRvfphJU0RSRlE2QUk2Z2c&usp=sharing

Qnap TS-670 Pro

Having some issues with my Lab set-up and the convoluted iSCSI presentation I setup.  It comprises a FreeNAS VM running on NAS storage that then has a VMDK attached running on the same NAS storage.  This VMDK is presented as iSCSI to the ESXi hosts (Nested and Physical hosts), so it give the impression it is SAN to those hosts.  I’m getting a lot of errors which cause the entire setup to freeze since the vCenter server is running on that storage.  I’m moving it off to a Qnap NAS to see if it stabilises the iSCSI but since that Qnap is shared with general CIFS file services for my Lab and home networks, am not confident about having my vCenter using it long-term!  Therefore, I have just bought myself, or rather bought Virtual Earthrunner, a Qnap TS-670 with 5x 3Tb Western Digital Red drives and a dual 1Gb NIC expansion to give me 4x NICs in total (1 for management and up to 3 for iSCSI).  The unit support up-to 6 disks so I’m going to make use of the SSD caching option available on that particular unit to house an old 40Gb SSD I’ve got hanging around doing nothing to experiment with.  With RAID5 this should give me a modest 12Tb usable capacity for my Lab network so my plan was to break this up into a small LUN for physical ESXi host, a small LUN for ISO storage and then 3 or 4 LUNs to present to the nested ESXi hosts and configure in a cluster to experiment with StorageDRS etc.




The main unit should arrive this week so I’ll hopefully have positive comments come next weekend.  It’ll be nice to actually have a true iSCSI storage solution that should reduce load on the DL380 as well since I’ll not be doing everything through a VM on that host.  I’m also planning to add an additional 32Gb RAM (64Gb total) and a quad-port NIC to expand to 8 ports so I can double up on storage and VM connections.

Since first publishing this article, the FreeNAS has experienced the same issue, but since moving my vCenter I don’t lose the complete environment.



Unattended & Automated ESXi

Today I managed to succeed in my objective of fully automating the base ESXi install and initial configuration using a PXE setup with TFTP and DHCP.  I have to configure the datastore array on the server (ready for automated partitioning) and ensure UEFI network book is off (opting for Legacy), but with the Lights-Out capabilities of the server this is easily done remotely.  Each host uses it’s own ks.cfg file so this has to be edited prior to deployment and a corresponding MAC address pxeclient file created.  I plan to use just one ks.cfg file with the kickstart process pulling network details during an initial DHCP boot via DNS (if possible) and this should eliminate the need to setup the MAC pxeclient file too if I decide to.

I used information gleaned from http://everythingshouldbevirtual.com/build-tftp-server-esxi-installs and http://www.geeksecrets.net/ to inspire me.

With hardware shipping to the DC soon, I wanted to be in a position where I could build and rebuild hosts from a remote location without having to faff around with USB or CDROM virtually mounted media.

Virtual Earthrunner IT Ltd is Born

Having secured a contract and now just seeking closure on all ‘open’ opportunities, a Ltd company is needed to progress.  Having picked the name ‘Virtual Earthrunner IT’ a few weeks back it was an easy task of completing the accountancy application forms where the company will be set-up in the process.  I already have a logo design and business cards set-up so once a bank account is in place (also set-up by the accountants) I’ll be acquiring these low cost extras.  I’ve opted to start life as a Ltd company owner using Nixon Williams as my accountants.  They seem to offer a good service for £95+VAT per month and I’ve opted to use their address as the main company address (as advised by several website on the subject), at an additional cost of £5+VAT.  There is no contractual tie-in so I’m free to switch accounts at a later date if necessary but I’m going to leave things as they are until I get settled and get my head around it all.

Here’s hoping for a long and prosperous career as a business owner and contractor/consultant.

Contract Availability – IMMEDIATE

John Parsons is now available for immediate contract work and is looking for infrastructure based roles where VMware plays a key part.  Skilled in both VMware vSphere & Horizon View deployments, John has designed, developed and implemented VMware infrastructures of up to 15 hosts supporting multiple clusters.  Using top end licensing, John has utilised the many features of vSphere, including HA/DRS/FT/VDP.  Backed by both fibre channel & iSCSI SAN’s with NAS storage to provide support for ISO stores and other low level requirements, John can maintain and support enterprise VMware environments.  The infrastructures mentioned all have 10GbE support to provide high speed and shared NIC services for the critical requirements of a cluster, such as the many VMKernels to support VMotion, FT, Mgmt, NAS storage & iSCSI.  Using HP Proliant DL380 servers, a mix of Procurve/Extreme Networks and EMC VNX/Qnap NAS/HP EVA storage, John has a broad depth of experience and skills with both hardware and virtualised software technologies.

The predominant OS used has been Windows where John has built Active Directory services, DNS & DHCP, Exchange environments (up to 2003 only), WSUS and BitLocker services to support a 600 user domain of up to 1000 devices and many more separated Windows Domain based solutions.  John does have experience with Linux, RedHat and CentOS primarily, and can install servers followed up by general day-to-day management activities.

From a security perspective, John is keen to maintain a high level of IT security and has worked as part of a team to handle high profile attacks such as state-sponsored APT.  To counter this and general IT threats John has implemented perimeter firewalls and other filtering tools such as proxy servers/email gateways, end point security, Splunk monitoring services and generated IT policies to drive a safe business environment.

As an experienced team/department lead, John is also capable of managing staff and workloads.  This experience has built over the past 14 years with team sizes from 2 up to 18.  Also captured are IT Strategy development, £2M+ budget management and presentation skills.  Having group leader experience has allowed John to develop service delivery skills and a keen approach to incident management through problem and change controls.

Available for immediate start, John is looking in the Guildford area and up to central London as the primary locations for contract work.  Ideal roles include 3rd line infrastructure support, infrastructure analyst, infrastructure support team leader and any mixture of these that result in John providing hands-on services within a VMware based infrastructure.  CV & daily rates available on request, flexibility on contract and rates possible.

New Blog Site

As you can see, this site is pretty new with not a lot of content at present.  I’m not a web designer but will try to jazz up the site a bit whilst keeping it simple to begin with.  If I get seriously bitten by the bug I’ll no doubt add lots of stuff, but short-term, it’ll be a slow build up I suspect.

Would love to hear advice from any expert bloggers to guide me in the right direction.