Good Morning!
Here is a start. One question I have is whether or not you are running WSUS on your network or not. Personally I think it would be better to use powershell to query your WSUS server with the vmname vs. querying the Machine. The reason being that WSUS is your central management location and should be your system of record for the patches.
Here is a way to get the list of VM's that are windows with their power state.
$vms = get-vm
foreach($vm in $vms) {
$vmview = $vm | get-view
if ($vmview.Summary.Config.GuestFullName -like "*Windows*"){
$vm
}
}
Now, when/if you want to search for the patch info, you have two options with line 5.
1. Use the $vm name to then invoke a script on the VM to determine patch actions.
2. Use the $vm name to query your WSUS server.
Let me know if you have more questions.