Hello,
Welcome to Microsoft Q&A,
You could use the below PowerShell command to see the VMs that do not have this extension enabled.
$vms = Get-AzVM
foreach ($vm in $vms) {
$extensions = Get-AzVMExtension -ResourceGroupName $vm.ResourceGroupName -VMName $vm.Name -ErrorAction SilentlyContinue
if ($extensions.Name -notcontains "AzureMonitorWindowsAgent") {
Write-Output "$($vm.Name) in $($vm.ResourceGroupName) does NOT have AzureMonitorWindowsAgent"
}
}
Please Upvote and accept the answer if it helps!!