Add-Type @" using System;using System.Text;using System.Runtime.InteropServices; public class W{ [DllImport("user32.dll")] public static extern bool EnumWindows(EnumWindowsProc cb,IntPtr p); public delegate bool EnumWindowsProc(IntPtr h,IntPtr p); [DllImport("user32.dll")] public static extern int GetWindowText(IntPtr h,StringBuilder s,int c); [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h); [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr h,out uint p); [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h,out R r); public struct R{public int L,T,Rr,B;} } "@ $target = (Get-Process btl4 -ErrorAction SilentlyContinue).Id if (-not $target) { Write-Output "btl4 NOT RUNNING"; exit } [W]::EnumWindows({ param($h,$l) $o = 0 [W]::GetWindowThreadProcessId($h, [ref]$o) | Out-Null if ($o -eq $target -and [W]::IsWindowVisible($h)) { $sb = New-Object System.Text.StringBuilder 256 [W]::GetWindowText($h, $sb, 256) | Out-Null $r = New-Object 'W+R' [W]::GetWindowRect($h, [ref]$r) | Out-Null Write-Output ("WIN '" + $sb.ToString() + "' at " + $r.L + "," + $r.T + " " + ($r.Rr-$r.L) + "x" + ($r.B-$r.T)) } return $true }, [IntPtr]::Zero) | Out-Null