Add-Type -TypeDefinition @' using System;using System.Runtime.InteropServices;using System.Text; public class W { [DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr l); [DllImport("user32.dll")] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n); [DllImport("user32.dll")] public static extern int GetWindowTextLength(IntPtr h); [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h); [DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr h, out RECT r); public delegate bool EnumProc(IntPtr h, IntPtr l); [StructLayout(LayoutKind.Sequential)] public struct RECT { public int Left,Top,Right,Bottom; } } '@ $list = New-Object System.Collections.ArrayList $cb = [W+EnumProc]{ param($h,$l) if ([W]::IsWindowVisible($h)) { $len = [W]::GetWindowTextLength($h) if ($len -gt 0) { $sb = New-Object System.Text.StringBuilder($len + 1) [W]::GetWindowText($h,$sb,$sb.Capacity) | Out-Null $r = New-Object W+RECT [W]::GetWindowRect($h,[ref]$r) | Out-Null [void]$list.Add(("{0}|{1}|{2},{3},{4},{5}" -f $h,$sb.ToString(),$r.Left,$r.Top,$r.Right,$r.Bottom)) } } return $true } [W]::EnumWindows($cb,[IntPtr]::Zero) | Out-Null $list | ForEach-Object { Write-Output $_ }