Skip to content

Instantly share code, notes, and snippets.

@technoscavenger
Last active November 27, 2025 21:09
Show Gist options
  • Select an option

  • Save technoscavenger/1395761f33721dd37be86c83a5925816 to your computer and use it in GitHub Desktop.

Select an option

Save technoscavenger/1395761f33721dd37be86c83a5925816 to your computer and use it in GitHub Desktop.
Get geometry for VNC session
Add-Type -AssemblyName System.Windows.Forms;
$wa = [System.Windows.Forms.Screen]::PrimaryScreen.WorkingArea
$titleBarHeight = [System.Windows.Forms.SystemInformation]::CaptionHeight
#$offset = 16 #VNC
$offset = 0 #RPD
$w = $wa.Height - $titleBarHeight - $offset
$h = $wa.Width - $offset
Write-Host "$($h)x$($w)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment