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.

## #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".

You might not even notice until you need it, but when you install the RSAT tools on Win 10 for 1709, the DNS manager console is missing. That’s exactly what happened to me. I needed to add some records in DNS and oops, where is it?

Well, there is a KB article on it, so there is a fix. :¬)

1. Check if KB 2693643 is installed, if so uninstall it
2. Create a temporary directory to put stuff in it
3. Create a “installx64.bat” file with the following content: [assuming you run a 64 bit Windows] <pre class="lang:default decode:true">@echo off md ex expand -f:* WindowsTH-RSAT_WS_1709-x64.msu ex\ cd ex md ex copy ..\unattend_x64.xml ex\ expand -f:* WindowsTH-KB2693643-x64.cab ex\ cd ex dism /online /apply-unattend=”unattend_x64.xml” cd ..\ dism /online /Add-Package /PackagePath:”WindowsTH-KB2693643-x64.cab” cd ..\ rmdir ex /s /q</pre>
4. Create a &#8220;unattend_x64.xml&#8221; file with the following content:

<pre class="lang:default decode:true ">&lt;?xml version="1.0" encoding="UTF-8"?&gt;   &lt;unattend xmlns="urn:schemas-microsoft-com:setup" description="Auto unattend" author="pkgmgr.exe"&gt;     &lt;servicing&gt;
&lt;package action="stage"&gt;
&lt;assemblyIdentity buildType="release" language="neutral" name="Microsoft-Windows-RemoteServerAdministrationTools-Client-Package-TopLevel" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" version="10.0.16299.2"/&gt;
&lt;source location="." permanence="temporary"/&gt;
&lt;/package&gt;     &lt;/servicing&gt;   &lt;/unattend&gt;</pre>

5. [Download the RSAT tools](https://www.microsoft.com/en-gb/download/details.aspx?id=45520) and put the msu file in the same folder

[<img class="size-full wp-image-704 aligncenter" src="http://blog.vvittig.com/wp-content/uploads/2018/02/2018-02-08_15-45-30.png" alt="" width="243" height="83" />](http://blog.vvittig.com/wp-content/uploads/2018/02/2018-02-08_15-45-30.png)

6. Start a command prompt with administrative permissions and run the &#8220;installx64.bat&#8221;

Once completed, you should have your full set (including DNS) of RSAT tools back

Resource: <https://support.microsoft.com/en-us/help/4055558></li> </ol>