Hyper-v .. .all VMs gone after upgrade

I had an issue after a inplace upgrade of a Hyper-v 2012R2 standard to 2016 Standard.
ALl VMs is missing and there is no errors in the eventlogg..
Running the below command fixed the issues and all vms reappeared in the MMC.
Havent had the time to real figureout what it does,
beyond that it has to do with WMI settings that gone corrupt.

"The Managed Object Format (MOF) compiler parses a file containing MOF statements and
adds the classes and class instances defined in the fileto the WMI repository.
MOF files are usually automatically compiled during the installation of the systems with
which they are provided, but you can also compile MOF files
by using this tool. "

https://docs.microsoft.com/en-us/windows/desktop/wmisdk/mofcomp

FIX:
MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mo

Time sync

# NTP Servers finns här om man önskar fler https://www.pool.ntp.org/zone/se Standard: se.pool.ntp.org

W32tm /register
w32tm /config /manualpeerlist:se.pool.ntp.org /syncfromflags:MANUAL
w32tm /config /update
w32tm /resync

W32tm /query /configuration

https://technet.microsoft.com/en-us/library/cc784553(WS.10).aspx

Live migrate Virtualmachines in 2 node cluster

## Live migrates all VM from 001cs to 002cs

$groups = Get-ClusterNode 001cs | Get-ClusterGroup | ?{ $_ | Get-ClusterResource | ?{ $_.ResourceType -like ”Virtual Machine” } }
foreach ( $group in $groups ) { $group | Move-ClusterVirtualMachineRole -Node 002CS }

Hyper-v network issue – NIC is already Bound…

Multi homes Hyper-v servers får i bland egenheten att en extra virtuell switch finns , som inte är kopplad alls..

Lös detta genom följande kommanden (installerar om Microsoft Virtual Netowrk Switch Protocols)

netcfg -u vms_pp

netcfg -c p -i vms_pp

Enabla VSS Backup Hyper-V

För att enable VSS på hyper-v servern… kör följande .vbs

reg add ”HKLM\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\ApplicationSupport\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}”
pause
reg add ”HKLM\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\ApplicationSupport\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}” /v ”Application Identifier” /t Reg_SZ /d Hyper-V
pause
echo.
echo Nedanstående kollar om man verkligen skrev något till registeret och visar i såfall resultatet.
echo.
echo.
reg query ”HKLM\Software\Microsoft\windows nt\currentversion\WindowsServerBackup\ApplicationSupport\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}” /s
pause

Hyper-v Backup

As with anything you should be backing up your Hyper-V machines. I think that just goes without saying. Backing up Hyper-V has gotten easier with the addition of VSS and Windows Server Backup (WSB). WSB is a new feature in Windows Server 2008 that replaces the old NTBackup from days gone by. It is not installed by default but can be easily added with the Add Features wizard in Server Manager. Once installed there is one last setting you must configure before backing up the Hyper-V virtual machines.

While Hyper-V does support VSS backups, it is not enabled by default. I am not sure why but you need to set a few registry settings to get WSB to recognize the Hyper-V VSS writer. You can enable this with the following two registry settings.

Under
HKLM\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\ApplicationSupport
add the following key {66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE

Then under that newly created key add a new REG SZ string called Application Identifier with the value Hyper-V. Once that is done you are ready to go! To make it a bit easier you can copy and paste the following to a command line (with administrative privileges) and it will get it all set up for you. You will need to set this on all Hyper-V servers in your organization but there is no reboot required!

reg add ”HKLM\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\ApplicationSupport\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}”

reg add ”HKLM\Software\Microsoft\Windows NT\CurrentVersion\WindowsServerBackup\ApplicationSupport\{66841CD4-6DED-4F4B-8F17-FD23F8DDC3DE}” /v ”Application Identifier” /t Reg_SZ /d Hyper-V


For more information see:

Windows Server 2008 Backup Step By Step