SynopsisGets the application windows that are open on the local desktop.
- Get-Window [-Process] [-ShowBackgroundWindows]
- Get-Window [-Title] [-ShowBackgroundWindows]
- Get-Window [-ProcessID] [-ShowBackgroundWindows]
DescriptionThe Get-Window cmdlet gets the application windows that are open on the local desktop.
Without parameters Get-Window returns all of the currently open top level windows (a top level window being a window to an application that is not a dialog box and is visible to the user). You can also get specific top level windows by specifying the title of the window, the process name or process ID of the associated application.
- Process Return windows associated with this process name.
- ShowBackgroundWindow Show top level windows that are not necessarily visible to the user.
- Title Return windows with this title.
- ProcessID Return window associated with this process ID.
InputsGet-Window accepts the output of Get-Process as an input object.
OutputsGet-Window returns a Vexasoft.AppWindow object with details of the current window state and associated Windows application.
NotesThere are no notes associated with the Get-Window cmdlet.
Example 1This command will get all open application windows on the current desktop:
Example 2This command will get all open application windows on the current desktop and any background windows that the applications are holding:
Example 3This command will get any windows on the current desktop that belong to the Outlook application:
Example 4This command will get any windows that are open and associated with PID 5592:
C:\PS>Get-Window -ProcessID 5592
Example 5This command will get any windows with the title "Untitled - Notepad":
C:\PS>Get-Window -Title "Untitled - Notepad"
Example 6Get-Window can work in conjunction with the Get-Process cmdlet. This command will fetch any PowerShell processes running on the local computer and return any associated windows that are visible to the local user:
C:\PS>Get-Process *powershell* | Get-Window