A cool little trick. Sometimes GitHub/Jekyll does not like to rebuild, just ‘force’ a rebuild by pushing an empty commit.

git commit -m 'rebuild pages' --allow-empty
git push origin <branch-name>

Foy my new work I have to get cozy with Puppet. Puppet provides a great learning VM, however it is in a OVA format, and I need it as a VHD so I can use it with Hyper-V in my homelab.

There are several ways and utilities to convert an OVA to VHD

That script however seems to be finniky at times, depending on the OVA file. I found that the VirtualBox convert utility seems to work quote a bit easier and more reliable.

It’s as easy as this:

  1. Install VirtualBox (Just install the ‘Virtual Application’, no need for all the other stuff)
  2. Extract the VMDK from the OVA (e.g. with 7-Zip)
  3. Run this in an Admin CMD session:
    $VMDK = "c:\path\to\machine.vmdk"
    $VHD  = "c:\path\to\machine.vhd" #the utility will create the VHD for you
    & "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" clonemedium --format vhd $vmdk $VHD
    

    And voila, you should have a VHD from the OVA that you can use in Hyper-V.

EDIT: 12/10/2018

So yeah that was not enough to get it to work in Hyper-V after all. I ended up using the StartWind v2v Converter. After that the VM is still no happy, you have to start the vm in ‘rescue mode’ to get it to boot happily.

CentOS_Recure_mode_for_Puppet_Learning_VM


#Service announcement

I am currently in the process of moving my blog/website from Wordpress to Jekyll/Github Pages. Stuff will break and not work during the moves and I’m sure there will be some bugs left once all is moved. I know especially pictures in posts will be an issue.

Please be patient. Please and thank you!

#End Service Announcement


Have you ever found yourself needing to edit a long list with usernames, and you had to go in and manually clean that list up, format it properly, wrap it in quotes and so forth? Yeah, it’s painful, but I finally found this handy regex statement that makes it all better.

Expression:   (.+)
Replace with: '$1'

So let’s take we have a regular user list

After running the regex, we have them all neatly wrapped in quotes

Now we have this nice list, but let’s say we need that as a string in a line. regex? Yeah no problem!

Expression:   [\n\r]
Replace with: ,

Oh so handy, hope it saves you some time!

EDIT:

Adding another, removing blank lines in a script

^(?:[\t ]*(?:\r?\n|\r))+

Replace this with nothing to remove all empty lines. :¬)


I wanted to append information to the verbose output of a cmdlet so that logging is neater. Well, it seems there is no nice way to do that?

This is what I came up with, redirecting the verbose stream, manipulating the verbose string, and then write it verbose back out

$verbose_info = get-aduser awittig | set-aduser -Replace @{comment = 'test'} -Verbose 4>&1
write-verbose "$(get-date) - $($verbose_info -split ':')" -Verbose

#Output
VERBOSE: 04/2/2018 16:35:01 - Performing the operation "Set" on target "CN=Wittig\, Alexander,OU=users,OU=test,DC=AD,DC=bloodyshell,DC=com".

Source: https://blogs.technet.microsoft.com/heyscriptingguy/2014/03/30/understanding-streams-redirection-and…