Vibe coding while waiting on my packages

Recently, I was waiting on some packages to arrive via DHL Germany. As I also had some spare time, and it was raining outside, I was playing around with PowerShell and DHL’s API to see if I can get status of my packages in a nice (to me), formatted way.

TL;DR: I can. 🙂

The idea was to build a small script which will take in a list of tracking numbers from my incoming packages, check their latest statuses and any history it can find, and display it in a nice, formatted way.

So, it all started with exploring the API possibilities on DHL’s Developer website.

To be able to use their APIs, you must register (for a free account):

Next, you have to request API access, so that you get your API key and secret – you do this by creating an app and selecting APIs it will use (selected Shipment Tracking – Unified, as it sounded right):

Then you wait a bit for someone/something to approve your request (few minutes), and you are ready to go:

Now you have all the building blocks, and it’s time to code… finally. 🙂

I won’t explain the code line by line (it’s not that interesting and it could be written nicer), but will just say that I used the help of (the free) ChatGPT (or rather – it used my ideas?! Who knows… 😁), and “vibe-coded” the whole thing. There were errors, misunderstandings, etc., but we managed to get to something that does the job:

Just one thing – as I was looking at the outputs, I’ve seen these “detailed info” codes, and decided to explore what they mean – for this, I found a CSV file with the explanations, which I then decided to incorporate into my script… just for fun.

The script (Track-DHLShipment.ps1) is available on my GitHub.

What’s next? Don’t know… probably my packages will indeed arrive. 🙂

Cheers!

P.S. This was somewhat inspired by an episode from “Scott and Mark Learn To…” series of podcasts by Scott Hanselman and Mark Russinovich – make sure you subscribe and watch them regularly! They rock! 😊

Reinstalling your Hyper-V hosts

Have you ever reinstalled your Hyper-V hosts?

I know, there is not much need for it (as everything usually works just fine), but still… there is a “Windows Server 2016 re-installation wave” coming and maybe you’ll find the the next pieces interesting and useful.

One of the “messy” tasks with Windows reinstallation is networking… and by “messy” I mean “you have more than one network cable in your Hyper-V hosts” and you need to know which networks are connected where. Smile

What happens is that Windows somehow always forgets your network device order, all the pretty names you’ve applied and you get stuck with names like “Ethernet”, “Ethernet 2”, etc.

There is a way to fix this (there are many, actually) – we can ask our younger colleague to go to the server room and unplug the cables one by one and then plug them back in, following the rename on our (Windows) side. This way we are certain that all the corporate, DMZ, storage, live migration, etc. cables don’t get “confused” when added to their respective teams and if we labeled cables properly, everything will work with fresh Windows installation also.

But… there is another way. We can use what we already have – our documentation. Here I mean “our current setup” – we have our network adapters and teams already configured in our current Windows installation, why don’t we just export this info and use it after the reinstallation?

We can do this easily by using PowerShell!

The idea is to export network adapter names and MAC addresses of our physical network adapters (excluding the virtual and team adapters), in a CSV file, so that we can use it later, to rename our adapters after the reinstallation:

After reinstallation, we can use the following command to rename our adapters, as per our saved CSV file:

And voilà – our networks are named nicely again (and our colleague didn’t need to go to the cold server room… this time). Smile

Cheers!