ESXi NTP Configuration with PowerShell

As part of a recent automation workflow, I had cause to configure NTP on ESXi hosts. I honestly thought this would be easier than it was, but a couple of issues led me to “roll my own” function which I’m sharing here.

Continue reading “ESXi NTP Configuration with PowerShell”

Native TAR File Extraction with PowerShell

That’s right, tar-ball 😉

On one of my projects recently, I had cause to extract a .tar.gz file during the automation process. If you are in this scenario there are potentially a couple of options around this which I’ll cover off. However, I wanted a simple, native function with no dependencies, so keep reading to see what I’ve come up with.

Continue reading “Native TAR File Extraction with PowerShell”

Building ISO Files with PowerShell 7

A function that’s been part of my toolkit for a long time is New-ISOFile by Chris Wu. This excellent little function allowed you to build an ISO file directly from PowerShell, even a bootable one.

I came to use it recently on an automation project with PowerShell 7 and discovered there was some compatibility issue that prevented it from working. I noticed that the original Technet site that the function came from originally is now gone, so I considered this an opportunity for some code review and hopefully produce a revised function that works with PowerShell 7.

Continue reading “Building ISO Files with PowerShell 7”

ESXi & The Big MAC Mystery

A scripting “opportunity” came up this week. Apparently ESXi assigns a virtual (or “shadow”) MAC address to each of its physical adapters, over and above the native physical MAC. The request was to report on all of these MACs across a large number of hosts. Read on to see how this resulted in the Get-esxiShadowMAC function.

Continue reading “ESXi & The Big MAC Mystery”

Bulk Uplink Configuration on Distributed Switches

Recently, as part of some work to install new physical adapters into our ESXi hosts, I was asked to look at some automation around uplink failover order. If you ever have to change these, it can be somewhat tedious, especially if you have lots of port groups, switches and vCenters.

Since I’ve been slacking on the updates round here, I’ll go over the 2 functions that came out of that piece of work. Hopefully they will save someone else some pain 🙂

Continue reading “Bulk Uplink Configuration on Distributed Switches”

HTTP Multipart Forms and on the Fly Compression in PowerShell.

I recently did some work with the vRealize Operations Manager REST API using PowerShell. Part of the work was to do with policy export and import, which raised 2 interesting challenges from a PowerShell point of view:

Firstly, HTTP mutlipart form data. We use an HTTP request to send a file to the API, easy on it’s own using the -infile parameter on Invoke-RestMethod, but as soon as you start adding other fields this becomes a bit more involved.

Secondly, the API exports and imports XML policy files in .zip format. Given that this work was part of a CI/CD pipeline in Gitlab, I really didn’t want to be committing .zip files to Git. I also didn’t want to write out files to disk, but rather compress and decompress on the fly as required.

This led to some interesting constructs inside my functions which I thought I would blog about.

Continue reading “HTTP Multipart Forms and on the Fly Compression in PowerShell.”

VUMXtra 1.1 Update

This is just a quick post to mention that there’s a new VUMXtra 1.1 module now available. It’s mostly numerous small changes to satisfy my OCD. If I’m being honest, 1.0 was written “at pace” to get something functional and possibly ignored a lot of best practices. Using a bit of downtime over the Christmas break I’ve gone over the code and made some improvements. Read on the find out more…….

Continue reading “VUMXtra 1.1 Update”

PowerShell Performance Tuning

Performance tuning, everybody loves that. Maybe you got your car remapped for more power. Maybe you overclocked your CPU for some more GHz. Maybe you want to shave a few milliseconds off your PowerShell execution time but don’t know where to start. Today on The Dot Source, we’ll discuss benchmarking your current code, then looking at some code constructs that will bring those execution times down. Time to take that base model Honda and put $100,000 under the hood.

Continue reading “PowerShell Performance Tuning”

VUM Xtra Module: Extended VUM Automation with the VC Integrity API

Anyone who has been asked to automate vSphere Update Manager processes will know that the CMDlets included within PowerCLI are somewhat sparse. The current functionality focuses mainly around patch baselines and not much else. If you want to automate ESXi images, image baselines or baseline groups, you’re out of luck……until now 🙂

Continue reading “VUM Xtra Module: Extended VUM Automation with the VC Integrity API”