Mike Slinn

Multiscreen Windows Tracker Script

Published 2025-12-17. Last modified 2026-03-05.
Time to read: 1 minutes.

This page is part of the posts collection, categorized under Windows.

This article helps set the startup position of Microsoft Terminal.

PowerShell Script

The following PowerShell script tracks the mouse across multiple monitors.

multiscreen.ps1
# multiscreen.ps1 - Live Mouse Coordinate Tracker for 2025
# Mike Slinn mslinn@mslinn.com

Add-Type -AssemblyName System.Windows.Forms

Write-Host "--- Multi-Screen Coordinate Tracker ---" -ForegroundColor Cyan
Write-Host "Press CTRL+C to stop the script.`n" -ForegroundColor Yellow

while ($true) {
    # Get current global mouse position
    $pos = [System.Windows.Forms.Cursor]::Position

    # Get all screens to identify which one the mouse is on
    $currentScreen = [System.Windows.Forms.Screen]::FromPoint($pos)
    $screenName = $currentScreen.DeviceName.Replace("\\.\", "")

    # Construct the display string
    $output = "`r[Screen: $screenName] | X: $($pos.X.ToString().PadRight(6)) | Y: $($pos.Y.ToString().PadRight(6))"

    # Write to console without a new line for a "live" dashboard feel
    Write-Host $output -NoNewline

    Start-Sleep -Milliseconds 50
}

Running The Script

Enable script execution:

PowerShell (Administrative)
PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

See Add To Windows User Path if you need to add the directory you saved multiscreen.ps1 to the Windows user path.

multiscreen.ps1 can be run in any PowerShell.

PowerShell
PS C:\Users\Mike Slinn> multiscreen.ps1
--- Multi-Screen Coordinate Tracker ---
Press CTRL+C to stop the script.

[Screen: DISPLAY2] | X: -1524 | Y: 678 

The following shows the number of characters the current Bash terminal can display:

Shell
$ echo $COLUMNS
209 

Bugs

If the initialPosition has an invalid X or Y value, the coordinate is silently ignored and the window is positioned at the top left of the screen. Early in 2026, Microsoft Terminal Preview started treating all explicit coordinates as invalid, while non-Preview Terminal continued to work.

The following fragment of %LocalAppData%\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json is the settings file for Microsoft Terminal (not Preview).

Fragment of settings.json
"initialCols": 269,
"initialPosition": "-3830,1110",
* indicates a required field.

Please select the following to receive Mike Slinn’s newsletter:

You can unsubscribe at any time by clicking the link in the footer of emails.

Mike Slinn uses Mailchimp as his marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp’s privacy practices.