Network share feeds in WAC

You know about (and actively using) the Windows Admin Center (WAC), right?! 😉

While it’s great for managing your Microsoft infrastructure, it can also be extended with different extensions. You can even write and use your internal, custom extensions, which do… well, whatever you make them do. And you can read all about that here.

But let’s go back to the subject of today’s post – extensions can be installed via different feeds, either official or unofficial, provided by Microsoft or 3rd-party. You can easily add new feeds or remove existent by providing the feed location, which can be either a NuGet feed URL or a file share location, as stated in the official docs.

Using a file share location is easy:

  • you choose/create a folder:

  • share it (\\<my_server_name>\WACExtensions in my case):

  • and add it to your feeds – I’ll use the “PowerShell way”:
# import the WAC Extensions PowerShell module
Import-Module "C:\Program Files\Windows Admin Center\PowerShell\Modules\ExtensionTools"

# list current feeds
Get-Feed -GatewayEndpoint "https://wac.tklabs.eu/"
### https://aka.ms/sme-extension-catalog-feed

# add new extension feed (network share)
Add-Feed -GatewayEndpoint "https://wac.tklabs.eu/" -Feed "\\<my_server_name>\WACExtensions"

# check if added successfully
Get-Feed -GatewayEndpoint "https://wac.tklabs.eu/"
### https://aka.ms/sme-extension-catalog-feed

But no!

My feed seems to be added successfully, but it’s not showing in the list!

You can try the same through the web interface – it’s almost the same (OK, you’ll get the errors):

And permissions are fine, don’t worry. 😉

Why’s that?!

The catch here is that we added an empty folder/share – when adding this share, WAC intelligently looked into the folder, found nothing and (successfully) didn’t add our share to the feed list, as it’s empty. And yes, it also forgot to mention it when using PowerShell.

So, what can be done?

The workaround/solution is rather simple – just make sure you don’t add an empty feed/folder.

Just for fun – I’ve downloaded the HPE Extension for WAC, moved it into the WACExtensions shared folder and tried to add the feed again:

# add new extension feed (network share)
Add-Feed -GatewayEndpoint "https://wac.tklabs.eu/" -Feed "\\<my_server_name>\WACExtensions"

# check if added successfully
Get-Feed -GatewayEndpoint "https://wac.tklabs.eu/"
### https://aka.ms/sme-extension-catalog-feed
### \\<my_server_name>\WACExtensions

And – it worked! 😊

Cheers!

Fixing Hyper-V virtual machine import with Compare-VM

Well, I was rearranging some stuff the other day, and come to an interesting “lesson learned”, which I’ll share. 🙂

In my lab, I’ve had a Hyper-V server running Windows 2012 R2, which I finally wanted to upgrade to something newer. I’ve decided to go with the latest Windows Server Insider Preview (SA 20180), just for fun.

When trying to do an in-place upgrade, I was presented with the message “it can’t be done“, which is fine – my existing installation is with GUI, the new one will be Core.

So, evacuate everything and reinstall.

In the process, I’ve also reorganized some stuff (machines were moved to another disk, not all files were on the same place, etc.).

Installed Windows, installed Hyper-V, created VM switches, but when I tried to import it all back (from PowerShell… because I had no GUI anymore), I was presented with an error.

Error during virtual machine import was (I know – could’ve used more specific Import-VM command, which will select all the right folders and required options, but… learned something new by doing it this way!):

Import-VM -Path 'D:\VMs\azshci\azshci1\Virtual Machines\5381F80D-C752-42E0-AE26-6402B019B785.vmcx'
# Import-VM : Unable to import virtual machine due to configuration errors.  Please use Compare-VM to repair the virtual machine.
# At line:1 char:1
# + Import-VM -Path 'D:\VMs\azshci\azshci1\Virtual Machines\5381F80D-C752-42E0-AE26-6402B019B785.vmcx'
# + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#     + CategoryInfo          : InvalidOperation: (:) [Import-VM], VirtualizationException
#     + FullyQualifiedErrorId : OperationFailed,Microsoft.HyperV.PowerShell.Commands.ImportVM

So, the error says it all – “Please use Compare-VM to repair the virtual machine.” 🙂

But how?! 🙂

If you go to the docs page of Compare-VM, you can see how it’s used.

And, in my case, the whole process of repairing this virtual machine looks like this:

# create an incompatibility report for a virtual machine
$report = Compare-VM -Path 'D:\VMs\azshci\azshci1\Virtual Machines\5381F80D-C752-42E0-AE26-6402B019B785.vmcx'

# check the created report as some incompatibilities were found
$report
# VM                 : VirtualMachine (Name = 'azshci1') [Id = '5381F80D-C752-42E0-AE26-6402B019B785']
# OperationType      : ImportVirtualMachine
# ...
# Incompatibilities  : {40010, 40010, 40010, 40010}
# ...

# check what exactly is incompatible (VHD locations, in this case)
$report.Incompatibilities.Source | Format-Table
# VMName  ControllerType ControllerNumber ControllerLocation DiskNumber Path
# ------  -------------- ---------------- ------------------ ---------- ----
# azshci1 SCSI           0                0                             C:\VMs\azshci\azshci1\azshci1_0_0.vhdx
# azshci1 SCSI           1                0                             C:\VMs\azshci\azshci1\azshci1_1_0.vhdx
# azshci1 SCSI           1                1                             C:\VMs\azshci\azshci1\azshci1_1_1.vhdx
# azshci1 SCSI           1                2                             C:\VMs\azshci\azshci1\azshci1_1_2.vhdx

# fixing the VHD locations (by replacing C: with D: for all VHDs)
$report.Incompatibilities[0].Source | Set-VMHardDiskDrive -Path 'D:\VMs\azshci\azshci1\azshci1_0_0.vhdx'
$report.Incompatibilities[1].Source | Set-VMHardDiskDrive -Path 'D:\VMs\azshci\azshci1\azshci1_1_0.vhdx'
$report.Incompatibilities[2].Source | Set-VMHardDiskDrive -Path 'D:\VMs\azshci\azshci1\azshci1_1_1.vhdx'
$report.Incompatibilities[3].Source | Set-VMHardDiskDrive -Path 'D:\VMs\azshci\azshci1\azshci1_1_2.vhdx'

# recheck if all looks fine
$report.Incompatibilities.Source | Format-Table
# VMName  ControllerType ControllerNumber ControllerLocation DiskNumber Path
# ------  -------------- ---------------- ------------------ ---------- ----
# azshci1 SCSI           0                0                             D:\VMs\azshci\azshci1\azshci1_0_0.vhdx
# azshci1 SCSI           1                0                             D:\VMs\azshci\azshci1\azshci1_1_0.vhdx
# azshci1 SCSI           1                1                             D:\VMs\azshci\azshci1\azshci1_1_1.vhdx
# azshci1 SCSI           1                2                             D:\VMs\azshci\azshci1\azshci1_1_2.vhdx

# import the fixed virtual machine (success!)
Import-VM -CompatibilityReport $report
# Name    State CPUUsage(%) MemoryAssigned(M) Uptime   Status             Version
# ----    ----- ----------- ----------------- ------   ------             -------
# azshci1 Off   0           0                 00:00:00 Operating normally 9.0

Hope this helps you as well!

Cheers!