WordPress – Paste image from clipboard

I’ve wanted to be able to paste images directly from the clipboard into blog posts for a while now but never got around to looking for the plugin.

Here is the plugin i recommend by Jorn Lund
https://wordpress.org/plugins/the-paste/
install enable and you can then paste directly into posts in the “visual” editor mode like the one below

The plugin inserts the binary directly into the page with the correct formatting like this <img src=”data:image/png;base64,<the binary data>/>

 

Hyper-V Manager – Connect to VM CredSSP error

[Window Title]
Remote Desktop Connection

[Content]
An authentication error has occurred.
The function requested is not supported

Remote computer:
This could be due to CredSSP encryption oracle remediation.
For more information, see https://go.microsoft.com/fwlink/?linkid=866660

The most annoying part about this was everything was fine

So I did the usual checks

1. Make sure the Windows Remote Management (WS-Management) Service is running

2. verify that CredSSP is enabled

3. Review the current settings

4. Make sure delegation is allowed from the host hyper-v server

Everything looked ok

Finally I stumbled on this MS article on credssp remediation error when RDP

Made the necessary registry key and value here
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters
“AllowEncryptionOracle”=dword:00000002

There is no reboot required, it worked immediately.
Yes you may now be vulnerable to the encryption oracle attack see Microsoft here

Unable to Sync Microsoft Account on Domain Jonined PC

If you have a domain joined windows 10 pc you have just installed, you’ll notice you can’t add your Microsoft account anymore

If you still have access to you old registry hive, from the computer you had before that was windows 10, domain joined and synching your Microsoft account then you are in luck because you can port it to your new machine.
As long as you are logging into your new domain joined machine with the same domain account as before, the SID needs to matchup.

Hers is how

  1. Download a good registry hive viewer
  2. Get your old registry hive
  3. load it
  4. Export the old key with the sync details
  5. import into your new machine profile

Download Registry Viewer, its old and trusted from “regview.7z” here or I have a copy regview

Get your hands on the old Default Registry Hive from you old machine. You might need to override security settings to get to it %systemroot%\windows\system32\config\ there’s a file with no extension called “DEFAULT”

Open Registry Viewer and load the “DEFAULT” hive

Export the children of the following key
[HKEY_USERS\.DEFAULT\Software\Microsoft\IdentityCRL\StoredIdentities\

Double click on the exported registry key to bring into your new user hive

Voila your done

Windows HyperV Server inplace upgrade – broken network

Windows Server HyperV 2012 > 2012 R2 > 2019

Cannot connect HyperV Manager to HyperV server after in-place upgrade when your domain controller is a virtual machine

So you’ve decided on your upgrade path and committed to action, only to find out your HyperV virtual machines cannot be seen on your network after upgrade.

My home lab operates on 2012 HyperV console, as you should know that means no GUI, which i am very happy with for many reasons. The attack surface is minimal, the resources aren’t needlessly used up and best of all its free

I decided to upgrade, mainly because testing Microsoft Intune meant i needed to enable TPM in HyperV, that and i was due an upgrade anyway

Microsoft HyperV Server 2012 > HyperV 2012 R2 > HyperV 2019

So I downloaded HyperV Server 2012 R2, created a bootable usb and performed an in-place upgrade on my HyperV

Once completed i immediately faced connectivity problems. My home lab is budget, which means my Domain Controller is a VM, yup you guessed it, hosted by the HyperV server

So how do i fix a network when i can’t remotely connect HyperV manager to the HyperV server? The problem being the authentication method is not contactable, the DC as a VM cannot approve the connection request to the HyperV server because the virtual switch is no longer configured properly

My suspicion is that with any in-place windows upgrade, the network adapters always tend to renew in some way shape or form

Know you’re setup

To really understand this problem and the solution I should probably describe my network setup

My hyperV box has 4 VMs and 2 virtual switchs

  • swInternal (Internal LAN switch to my home LAN)
  • swExternal (External WAN switch to my virgin router that is currently in “modem mode”)
  • VM 1 = Firewall gateway (has two virtual NICs swInternal and swExternal)
  • VM 2 = Domain controller (swInternal)
  • VM 3 = webserver (reading this blog from it right now) (swInternal)
  • VM 4 = test machine (constantly being destroyed and re created) (swInternal)

My setup is such that the firewall gateway VM has two network adapters, one for my internal LAN and one for the WAN. The rest of the VMs only have the internal LAN

Identify the problem

  • We cannot connect or see any of the VMs on the LAN, cant ping anything
  • We can’t connect HyperV manager to the HyperV server
  • We can however connect directly using a spare keyboard, mouse and display. Login and then break out PowerShell

Solving the problem

There is a 99% chance that fixing the virtual switches will solve all our problems, so whats the process?

You will need to know a local admin account for your hyperv server

  • 1. Shutdown all VMs
  • 2. Review the current setup. Enumerate the Virtual Switchs, and VM adapters
  • 3. Detach the adapters from the VMs
  • 4. Destroy and recreate the virtual switches
  • 5. Re attach the adapters to the VMs

sounds simple right? ok lets crack on

login to HyperV and execute the following PowerShell commands

This will give you an idea of the current switch setup

From here you can tell I have two hardware NICs and one Virtual NIC on the HyperV machine itself
I also have two virtual switches
And the virtual machines have all been assigned accordingly
In a broken environment you would likely see no IP addresses, moreover the Status’s would be different

So now we need to destroy and recreate everything

  1. Stop all the VM’s
  2. Disconnect the virtual adapters from the VM’s
  3. Remove the virtual switch’s
  4. Recreate the virtual switches
  5. Re attach the virtual adapters

Stop all VM’s

I’ve filtered this command to only stop VM’s that are running

Disconnect the virtual adapters

I’ve filtered this command to filter out the swExternal virtual switch.

Remove the HyperV virtual switch

I only want to remove the swInternal Switch

At this point I decided to rename my Network adapters on the Host, you dont have to do this at this stage.

Re-Create HyperV Virtual Switch

I’ve shown here commands to create the external switches as if the External switch didnt exist. The only difference between the two is that I’m not allowing the swExternal switch management os connectivity.

The difference between a switch category of “internal” & “external” is that internal will isolate the switch from your LAN, keeping internal to the VM host. So basically if you want connectivity to your LAN, always create a virtual switch categorised as External, which is in fact the default category, so you dont need to specify it on creation

If you want to tweak the settings on your newly created switches you can you the following command

Re-Attach the HyperV Virtual machine adapters

I’ve filtered this command to avoid adapters already connected to the swExternal switch here,

Now that the HyperV Host adapters, and Virtual switch’s have been reconfigured you are now ready to start the VMs

At this point i’d recommend restarting your HyperV host, If you have a Domain controller as a VM you’ll need to.
If you are still having connectivity issues you can further diagnose the it by dropping the firewall of the HyperV host by running the following command

If you are having problems with network adapters not setting the correct connection profile, you can force the profile to change

Mopping up

Finally we need to tidy-up the windows.old folder created on the root.
3 steps.
1. Take ownership of the folder
2. reset the security permissions
3. delete the folder