Here is a PowerShell script to check the Image or Model versions of each instance in an Azure Virtual Machine Scale Set (VMSS):
$ResourceGroup = "p-we1dep"
$Vmss = "p-we1dep-windows-vmss"
// Find all the instances in the VMSS
$Instances = Get-AzVmssVM -ResourceGroupName $ResourceGroup -Name $Vmss
Write-Host "Instance image versions of VMMS: $Vmss"
// For each instance in the VMSS
foreach ($Instance in $Instances) {
// Get the exact version of the instance
$InstanceInfo = (Get-AzVmssVM -ResourceGroupName $ResourceGroup -Name $Vmss -InstanceId $Instance.instanceId).StorageProfile.ImageReference.ExactVersion
$Id = $Instance.instanceId
// Echo the instance ID and Exact Version
Write-Host "Instance $Id - $InstanceExactVersion"
}