$procs = Get-Process | Where-Object { ($_.ProcessName -eq 'Weixin' -or $_.ProcessName -eq 'WeChat') -and $_.MainWindowHandle -ne 0 }
if (-not $procs) {
  Write-Host "WeChat / Weixin not running (or window is hidden)"
  exit 1
}
foreach ($p in $procs) {
  $ver = $p.MainModule.FileVersionInfo.FileVersion
  Write-Host "ProcessName: $($p.ProcessName)"
  Write-Host "PID:         $($p.Id)"
  Write-Host "HWND:        $($p.MainWindowHandle)"
  Write-Host "Version:     $ver"
  Write-Host "MainPath:    $($p.MainModule.FileName)"
}
