add-type @" using System; using System.Runtime.InteropServices; namespace Huddled { public class Tricks { [DllImport("user32.dll")] private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); public static void ShowWindow(IntPtr hWnd) { ShowWindowAsync(hWnd,5); } public static void HideWindow(IntPtr hWnd) { ShowWindowAsync(hWnd,0); } } } "@ Get-Process | Where MainWindowHandle | % { [Huddled.Tricks]::HideWindow( $_.MainWindowHandle ) }