List the OS configured for your VMs.

This code will give you a list of all VM names and the OS configured for it. This code does not tell you what OS is running within your VM. You need vmware tools running within the guest to pull that info. You could you this script combined with the guest OS check to make sure they match.
**note – I added an if statement to filter if you only want Windows OS. Edit as needed.

connect-viserver “myvCenter”
$vmlist = @()
$GuestOSCheck = Get-VM | Get-View | Select name, @{N=”OS”;E={$_.Summary.Config.GuestFullName}}
foreach($single in $guestOSCHeck){
if($single.os -match “Windows”){
$vmlist += $single
Disconnect-viserver -confirm:$False