I am using below script to create report of the hosts with Operating system. I noticed some of the VMs have Source Image Offer
different than Operating system
as those were upgraded in-place.
Is there way to fetch this information from Azure PowerShell?
$vm = Get-AzVM -ResourceGroupName my-rg -Name myhostname1
$offer = $vm.StorageProfile.ImageReference.Offer # Windows-10
$sku = $vm.StorageProfile.ImageReference.Sku # win10-22h2-ent-g2
Expected outcome is: Windows (Windows 11 Enterprise)
.
2
Answers
In your case, the Source Image Offer is different from the
Operating system
. You can find the correctOperating System
information using the command below.This will fetch the VM OS information available in Systeminfo, not from the
azure portal
, allowing you to find the correct information.Here is the
Azure PowerShell
command to fetch theVM Source Image Offer details
which are available in azure portal.Have you tried this? by adding
-Status
Which also return the OS namd and version
result: