After making sure to enable virtualization services in the BIOS, and making sure that a hyper-v compatible OS is installed(windows 10+ pro or enterprise version, or windows server 2016+)
To enable hyper-v services, type in powershell: DISM /Online /Enable-Feature /All /FeatureName:Microsoft-Hyper-V && Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
After restart, the hyperv manager should be findable in the search bar.
On HYper-v manager: Chose your machine in the left hand side of the window.
Before creating VMs, we need a virtual network adapter in order to be able to connect our vms to the internet.
We create one from the right hand side > Virtual Switch Manager > Create Virtual Switch > External > Create Virtual Switch.
Give it a name and make sure that the correct external network option is selected ad that the allow management system to share this connection is also selected.
This will now be the network interface used by both the main OS and the VMs. The network configuration will be copied automatically.
We are ready to create our VMs. Click New > VM > Next > Select any genaration > Allocate as much RAM as you thik you need > assign the previously created virtual switch > either create a new virtual hard disk or select an existing one(previously created, imported, or pre-made VMs with your OS of choice.) > finish.
Your VM is ready to launch.
Please keep in mind that unless our server uses DHCP for automatic ipv4 aquisition(not the case with rented servers since we have static IP), any created VM will have to have it's IPv4 manually set on the same 127.0.0.1/24 subnet as the host(main system) from the vm's OS network settings.
This means that we will need to search trough trial and error for a free address in our server's subnet or just buy an extra ip from our provider.
The advantage of this is that our VM will have a separate address than our main system and it will be connected directly to the internet(which is very useful when using pentesting tools).
The alternative to this is to create a new NAT virtual switch as explained here: https://www.techielass.com/set-up-a-hyper-v-virtual-switch-using-a-nat-network/ .
After creating the switch, when creating the VM, select this one instead of the one created in the previous step.
Wi will still have to manually configure the connection settings in the VM's OS, but this time we won't set it on the host's subnet but rather on the 192.168.0.0/16 NAT subnet.
This means that the VM will share the host system's IP when connecting to the web and we won't need to hunt for a free address or purchase one.
these are the main points about working with hyper-v also, for installing an os, on the VM, if it's giving you problems, click on the vm > VM settings > secure boot > uncheck enable secure boot.