Posts

  • Documenting your Household

    While reading through my RSS feeds last week, I came across a HackerNews post about Home Documentation. I’ve a huge fan of documenting all of the things, and I was currently revisiting both the content, and the platform on which I document, so I thought I’d add my 2¢.
  • Platform Engineering - The Fundamentals of Developer Experience

    Teams launching new internal developer platforms often fall into the trap of creating technically-advanced solutions, using cutting edge tooling, but forgetting to think much about usability from the customer perspective. I think this is typically because these platforms been built by engineers who have inevitably been immersed in those specific technologies for so long that they’ve forgotten what it’s like to approach it for the first time.
  • The Bacon Test

    Photo by Michelle @Shelly Captures It on Unsplash It’s fair to say that the primary toolset used by our private-cloud engineers (vRealize Automation and vRealize Orchestrator) are not widely used, and we historically have not had have a large pool of experienced local talent from which to draw. We therefore tended to hire general IT people with a knack for solving technical problems. These people tend to be infrastructure engineers with a flair for automation.
  • More re-organisation

    I’ve moved the site out of Ghost (where I’d managed to end up in some version cul-de-sac, which was going to require multiple intermediate migrations to get out of), and into Jekyll.
  • Using the vRealize 7.x REST API to get a tenant's Event Broker subscriptions

    After migrating from vRealize Automation (vRA) 6.2, we’ve recently started the long-overdue work of investigating the new functionality introduced with the event broker. We’re still using the state-change triggered workflows for machine life-cycle integration between vRA and vRealize Orchestration (vRO), and that’s going to be a big-job to change; but I thought I could maybe look at one of our other requirements which was to ensure that changes to blueprints made using the GUI get stored in source control.
  • Using VMware vRealize Orchestrator to run a Jenkins job and get the results

    VMware vRealize Orchestrator (vRO) is pretty flexible, but there are times when you still need to execute a job on Jenkins.
  • vRealize Automation - Setting the Orchestrator Server using Custom Properties

    We’re soon going to be implementing multiple vRealize Orchestrator (vRO) servers in our vRealize Automation (vRA) development environment to allow people to choose different endpoints. Essentially if someone’s working on a workflow, that shouldn’t affect a different developer who is testing a template. So I wanted a way of allowing customers (in this case, developers) to choose from a list of Orchestrator endpoints. This might be useful in the following cases: Allowing specific customers to...
  • PowerShell script to restart a Virgin Media SuperHub

    This almost certainly will not work anymore, but I'm leaving it here in case it's useful to anyone doing anything similar. Sometimes, after a week or so of uptime, I find that wireless access through my Virgin Media SuperHub gets very slow (wired access is fine). Like most IT issues, the issue can be fixed with a restart, but as it’s a wireless issue, restarting the router via the web interface is sometimes out of the question. I usually end up having to go next door and restart the router manually.
  • Auto-generating PowerShell documentation in MarkDown

    I don’t mind writing documentation for my scripts, but I find that most documentation writing exercises tends to suffers from two problems:- Duplicated effort - I tend to document my script inline, (so that Get-Help will work), why do I need to document the same details elsewhere? Keeping it up-to-date - The only thing worse than no documentation, is clearly outdated documentation.
  • Using an Ubuntu CrashPlan appliance to backup a NAS

    I’ve recently upgraded some of my home setup; instead of Windows Home Server 2011 managing everything, I’m now using a NetGear ReadyNAS 104, to serve files and using Windows Server 2012 R2 for the other functions.
  • Get VDI Capacity Information from the Horizon View ADAM Database

    Quick script to assist with capacity planning.
  • AppSense and VMware View Horizon Linked Clones

    The move from persistent physical desktops, to non-persistent linked clones (with a separate user personalisation layer) requires rethinking the way in which machines are configured and software is deployed. The challenge is to deliver a consistent, highly available platform with the maximum efficiency. In this case efficiency means utilising Horizon View’s ability to dynamically provision just enough desktops, while ensuring that the necessary configuration changes are delivered by AppSense. Computer configuration We do the bulk...
  • Displaying vSphere disk properties (including provisioning & persistence)

    I was doing some tidying of old scripts and came across something I thought it might be useful, so I tidied it up and added some documentation. This PowerShell script uses the vSphere PowerCLI to display a list of virtual machine disks, file-names, modes (persistent or non-persistent), sizes and whether or not the disk is thinly provisioned. You’ll need to connect to one or more vSphere servers first. # Create an empty array for results...
  • Accessing SCSM 2012 using PowerShell (without SMLets)

    I wanted to use PowerShell to create a simple report of open (active & pending) incidents in System Center Service Manager 2012, but the only examples I could find online used the SMLets. Sometimes this wasn’t obvious, but soon became apparent when PowerShell choked over CMDLets like Get-SCSMObject. While I’m sure the SMLets are handy for ad-hoc reports by administrators, I wanted the option for my report to be generated by a group of users...
  • Remove machine objects from VMWare View's ADAM database with PowerShell

    26/02/14 - I've updated this script to accept pipeline input and work a little more efficiently when removing multiple machines. It’s one of those things that shouldn’t happen, but which inevitable does. Someone removes a View managed VM from vSphere, and View refuses to realise it’s gone. It also sometimes happens when machines fail to provision correctly (i.e., due to lack of available storage). The procedure is easy enough to follow, but it’s time-consuming and...
  • Invoke a PowerShell script directly from Subversion

    I’ve been thinking about doing something like this for a while. By adding this to PowerShell profiles, I can ensure that other people who use my scripts/functions are using the latest versions by having them run directly from a Subversion URL. This negates the requirement for them to have a local SVN repo (and for them to keep it up to date). Our Subversion is set up for basic, rather than AD integrated, authentication, but...
  • Using AppSense to deliver Microsoft App-V 5 applications to non-persistent VDI desktops at logon

    I’m currently working on user-centric application delivery to non-persistent VDI desktops. The rationale for this is that the more applications which can be delivered dynamically, the fewer pools we need to provision. This suits applications like Microsoft Project and Visio, which both tend to be used by a small number of people on each pool. These apps are too expensive to deploy to non-users, and need locked-down to fulfil license requirements if deployed under Citrix....
  • Get logon timings from AppSense client log

    I’m doing logon tuning just now for non-persistent VDI desktops - seeing long it takes to deploy App-V packages on a per-user basis to a generic desktop based on AD group membership. To assist with the tuning, I thought it would be useful to write a quick PowerShell function to gather information from the AppSense event logs in a way that allowed easy sorting, display, recording and comparison.
  • Server Uptime (2013 Scripting Games practice)

    This script will not work on PowerShell Core. I’m not sure yet if I’ll take part in the 2013 Scripting Games; but as the the practice exercise dovetailed nicely with a requirement I had, I thought I’d give it a shot.
  • PowerShell function to check whether a computer is responding to Ping

    This function will not work on PowerShell Core. But you should probably be using Test-Connection regardless. A lot of my scripts use Active Directory to create lists of servers. Unfortunately, AD often contains decommissioned computer objects, which can cause certain queries to time-out I wrote this quick function so that before running WMI queries against a server, we could do a quick check to see whether it was online.
  • Using the WebSphere MQ PowerShell library

    I’ve been doing some work with IBM WebSphere MQ recently. Specifically I’ve been helping to create a (temporary) reporting and monitoring tool which will periodically check channel status and depth of certain queues. While the application has it’s own command-line utility (MQSC) I’ve been trying to work using the WebSphere MQ Windows PowerShell library. After downloading the file I followed the installation instructions, and immediately ran into the following error when trying to load the...
  • Getting VMWare View pool utilisation

    We needed a way to keep track of how many users had been granted permission on a pool to ensure that there were plenty of provisioned desktops. Knowing that it’s possible to list the number of machines in a pool, and the entitled users and groups using View CMDLets on a connection server via a PSRemote session, and knowing that it’s possible to enumerate the total number of users in a group (including indirect membership);...
  • PowerCLI to display VM name and screen resolution

    One-liner PowerCLI to output a list of machine names and screen resolutions.
  • Getting PCOIP statistics via WMI using PowerShell

    I was at a training course last week and it was mentioned briefly on one of the slides that PCOIP session statistics were available via WMI. After a quick Google, I found MyVirtualCloud’s page, which details the class, and property names. The following is a PowerShell function, which pulls this information from WMI, appends the names and descriptions, and returns an object. You could, for example, export the returned object to an HTML page. Or...
  • Formatting PowerShell tables with jQuery and DataTables

    One of the great things about PowerShell is its ability to easily export objects to HTML, which - with a little CSS - makes it straightforward to create great-looking reports. But static lists of data aren’t enough any more, the people demand interactivity.
  • Creating shortcuts to PowerShell Scripts

    You’ve probably noticed that when you double-click on a PowerShell script, it is opened for editing rather than being run. This is useful from a security standpoint, and while administrators have no problem opening up the shell and running the script, you’ve probably made something useful that you want to share with users, and users always need a bit more hand-holding.
  • Automatically setting the machine owner as a custom attribute

    As we are constantly creating, moving, renaming and deleting machines, it’s difficult enough to keep track of machines I have deployed myself; never mind keeping track of what the other team members are doing. In order to try make it easier to find the owner of a machine, we implemented a custom attribute “Infrastructure Consultant”, which the analyst should complete. Inevitably, despite the best of intentions, this is occasionally missed, and we end up with...
  • Automatically converting machines to thin provisioned format

    I haven’t been posting too much here recently I’m afraid. A lot of the things that I’m currently working on are pretty specific to the environment here, and are not particularly useful (or indeed, interesting) to anyone else. One of the things I’ve been doing might be more generally useful. We needed to convert around 700 of our machines to thin-provisioned format. When migrating to the new environment we’d stuck to traditional “thick” machines, as...
  • Preventing computer password expiry

    If, like me, you work with non-persistent virtual machines on Windows domains, you will be familiar with your machines becoming periodically disconnected from the domain. This usually manifests itself in the following error message when you attempt to log on:- “The trust relationship between this workstation and the primary domain failed.” The problem is detailed in this KB Article. What happens is that every 30 days (by default) the client initiates a computer password change...
  • Changing drive letter assignments after deploying a virtual machine from a template

    We’ve had an ongoing problem with “Sequencing” machines for Microsoft Application Virtualisation (formerly SoftGrid). The virtual machine template is correctly set up with a secondary drive set to Q:\ (the drive letter is integral to the sequencing process). However, when the machines are deployed from the template, the Sysprep part of the customization process results in the drive being “reset” to the lowest available - in this case D:. At first, we manually changed these...
  • Manually creating linked clones in vSphere

    We’ve started our first “proper” implementation of Linked Clones in our vSphere 4 environment. While we’ve done some limited proof-of-concept work, this is the first project to be entirely deployed using Linked Clones. The objective is to reduce the space used by our training machines on our new environment. Linked clones allow multiple machines to share a common read-only “base” VMDK file, with each machine generating their own delta (REDO). Under normal usage circumstances, the...
  • Using SDelete to maximise the amount of disk space reclaimed during conversion to thin-provisioned disks

    We’re currently neck-deep in migration at the moment, but despite the workload, it’s always worth considering what we can do now, that might save us some time and effort later on. One of the reasons we were moving to vSphere was the ability to thin-provision (TP) our disks, which we’re hoping will allow us to increase the amount of machines that we can provision without needing to allocate more storage (currently 18 TB). I found...
  • Get the last user to power down a VM

    We can use PowerShell to search through the event logs of a machine object ($objVM in the example below) for events which match a specific pattern - in this case powering off a machine. Once we have the event object, we can access the properties of the first object in the array (the most recent event).
  • vCenter and host build numbers

    This is based on Carter Shanklin’s PowerShell snippets to query VC and ESX build version numbers. This script loops through the list of vCenter servers, and gets their version and build info, as well as the version and build info for it’s connected hosts.
  • Script to add a hash table full of virtual port groups to vSphere hosts

    As part of the migration I’m working on, we needed to add a whole bunch of Virtual Port Groups with associated VLANs to the servers. The following script could do this in a few minutes (although Host Profiles would accomplish much the same thing, we’re not running Enterprise).
  • Script to add VMX path to vSphere Client as a custom attribute

    I love it when I have an idea in my head of a script I need to write, and then I run across one that does exactly what I need! Hugo Peeter’s has written a script to add VMX location as a custom attribute.
  • Understanding memory resource management in VMware ESX

    VMware have published an excellent white paper on memory management [pdf]. The document is technically detailed, but makes interesting reading. The authors do a good job of describing the methods ESX uses to manage and allocate virtual memory; and how when guests deallocate memory it’s not necessarily freed up for reuse by other guests. This should prevent you from allocating more memory to guests than is physically available on the host (overcommitting); however the hypervisor...
  • Export and import vSphere customization specifications using PowerShell

    I’m in the middle of preparing for a migration from VMware Virtual Infrastructure 3 to vSphere 4 just now (hence the lack of any substantial updates on this blog). As part of this process, I was just about to start writing a script to export our customisation specifications, when Arnim van Lieshout’s post appeared in my VMware Planet V12N RSS feed. Export and import customization profiles using Powershell. It failed on a couple of customisations,...
  • Cleaning up VM template names

    I wrote this today to remove occurrences of the string “Tmpl” anywhere in the name of the template, and then to re-name the template with “Tmpl” as a prefix. It had a higher purpose than keeping everything nice and neat, but it’s rather specific to our environment so I won’t bother going into the details.
  • Virtual machine BSoD detector

    Carter Shanklin has used Microsoft Office Document Imaging Library (MODI) to improve Eric Sloof’s script to detect Blue Screens of Death (BSoDs); it now captures the errors and converts them to text. From Eric’s blog: …first it captures a screenshot of a virtual machine. Secondly it uses the Toolkit Extensions to copy it to the local drive. When the PNG image is saved on the local drive, it’s converted to TIFF. The TIFF image will...
  • Check if servers in a text list exist as VMware VMs

    I got handed a list of around 1,000 servers today, and asked if any of them were part of our VI environment. Rather than work through it by hand, I wrote the following script.
  • Thin Provisioning in ESX 3.5

    One of the nice new features of vSphere 4 is thin provisioning of virtual disks. Thin provisioned (TP) disks will be familiar if you’ve ever used VMware Workstation where they are used by default, (you need to select Allocate all disk space now to create thick disks). Essentially, rather than allocate all disk space at creation, disk space is allocated on the fly, meaning that a 50 GB virtual disk with only 5 GB being...
  • Add disk persistence information to the VI Client using PowerShell

    I’ve further adapted Hugo’s script to add a custom attribute which shows the drive persistence state(s) when the script was run.
  • Add disk size information to the VI Client using PowerShell

    This is based on Hugo Peeters’ script to add snapshot information to the VI client using PowerShell. Our users occasionally need larger machines created for packaging big applications. After increasing the size, we used to append the VM Object name (e.g, “PACKVM01 - 10GB”), but this caused a mismatch between the virtual machine object name in VIC and the DNS host name. Also, it looked untidy! We needed a new way for VIC users to easily see which were the larger machines, so I modified Hugo’s script to add disk size as a custom attribute.
  • Creating new Virtual Port Groups in ESX with PowerShell

    We frequently need to create new virtual port groups on our ESX hosts with VLAN tags which correspond to pre-assigned DHCP scopes. I wrote this PowerShell script to create the new VPG across all hosts.
  • Find vSphere templates with non-persistent disks

    As we’re running a development lab, we use a lot of templates for machine deployment and a lot of non-persistent disks to allow machines to be easily restored to a clean-state. We’ve had issues where machines with non-persistent disks were converted to templates. In this case guest customisation will fail. This script looks at your templates, and outputs a list of those with non-persistent drives.
  • Resolving Virtual Machine object name and DNS name mismatches using PowerCLI

    We were working recently to align our guest virtual machine object names (the ones shown in vSphere) with their DNS names. As we have over 800 guests, this would have taken us a while to compile by hand. In order to make the process a little easier, I wrote the following PowerShell script to flag machines where the hostname differs from the object name.