Show window titles

Displays the titles of all visible windows running in the user session

Version: 1.0.1
Created: 2019-01-13T11:53:32.173
Modified: 2019-01-13T11:53:32.173
Creator: Guy Leech
Downloads: 217
The Script Copy Script Copied to clipboard

<# Show Window titles for processes. Must run as the user owning the session otherwise window information is not available @guyrleech 2019 #>

if( ! $args -or ! $args.Count )
Throw ‘Must pass the session id as the only parameter’

[int]$thisSessionId = $args[0] -as [int]

[int]$outputWidth = 400

# Altering the size of the PS Buffer
$PSWindow = (Get-Host).UI.RawUI
$WideDimensions = $PSWindow.BufferSize
$WideDimensions.Width = $outputWidth
$PSWindow.BufferSize = $WideDimensions

[array]$processes = @( Get-Process | Where-Object { $_.SessionId -eq $thisSessionId -and $_.MainWindowTitle } )

if( $processes -and $processes.Count )
$processes | Format-Table -AutoSize -Property Id,ProcessName,MainWindowTitle,FileVersion,StartTime
Write-Warning “No processes with window titles found in session id $thisSessionId”


Get Your Download Link

Gain access to ControlUp from your PC. Register and get a link to start your Free Trial.