The Problem Every SysAdmin Knows Too Well
You have 8 Remote Desktop windows open. One is PROD-DB, one is TEST-APP, another is your local dev box. They all look identical. You need to restart a service... and you click the wrong window.
Production is down.
Sound familiar? The native Windows MSTSC client doesn't give you visual cues. Sure, you can hover over the taskbar to see the hostname, but when you're moving fast, mistakes happen.
The "Old School" Workaround (And Why It Sucks)
Most admins resort to:
-
Editing the remote machine's hostname to include
[PROD]or[TEST] - Using third-party RDP managers like mRemoteNG or RD Tabs
- Just being really, really careful (spoiler: doesn't work)
But what if you could keep using the native MSTSC client and still get instant visual feedback?
Introducing: RDP Title Master
RDP Title Master is a tiny background utility that:
- Monitors all your RDP windows in real-time
- Matches window titles against your custom rules (IP addresses, hostnames)
- Overlays a color-coded badge directly on the MSTSC toolbar
Note: I'd love to show you a screenshot, but ironically, I switched to macOS right after building this tool! If you try it out, please share a screenshot in the comments โ I'd genuinely love to see it in action. ๐
Example Config (settings.json)
[
{
"Pattern": "prod",
"Label": "๐ฅ PRODUCTION",
"ColorHex": "#e74c3c"
},
{
"Pattern": "192.168",
"Label": "๐ LOCAL",
"ColorHex": "#2ecc71"
},
{
"Pattern": "test",
"Label": "๐งช TEST",
"ColorHex": "#3498db"
}
]
When you connect to prod-db-01.company.com, the toolbar instantly shows a red badge saying "PRODUCTION". No more guessing.
How It Works (Technical Deep Dive)
1. Window Detection
The tool uses EnumWindows to scan all top-level windows, looking for the RDP window class:
private static bool IsRdpWindow(IntPtr hwnd)
{
string className = GetClassName(hwnd);
return className == "TscShellContainerClass";
}
2. Title Matching
Once an RDP window is found, we grab its title (which usually contains the hostname or IP):
string title = GetWindowTitle(hwnd);
var rule = _configs.FirstOrDefault(c =>
title.Contains(c.Pattern, StringComparison.OrdinalIgnoreCase)
);
3. GDI+ Overlay
We create a transparent bitmap with anti-aliased text and a rounded badge background, then apply it using UpdateLayeredWindow:
using (Graphics g = Graphics.FromImage(bmp))
{
g.SmoothingMode = SmoothingMode.AntiAlias;
g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
// Draw rounded rectangle badge
FillRoundedRectangle(g, bgBrush, badgeRect, 10);
// Draw text on top
g.DrawString(text, font, textBrush, x, y);
}
4. Daemon Mode
The app runs in an infinite loop (every 3 seconds), checking for new RDP windows. This means you can start it once in the morning and forget about it.
Why C# and Not Python/PowerShell?
Short answer: Performance and distribution.
- Single .exe: No runtime dependencies. Just download and run.
- GDI+ Quality: Native access to Windows graphics APIs for smooth rendering.
- Size: With trimming enabled, the final binary is ~50MB (self-contained .NET 8).
The original prototype was in Python (still available in the repo's legacy_python/ folder), but C# made it production-ready.
Installation & Usage
Quick Start
- Download the latest release from GitHub
- Edit
settings.jsonwith your server patterns - Run
MstscTitleBar.exe - Open any RDP session and watch the magic happen
Building from Source
git clone https://github.com/mlanies/mstsc_title_bar.git
cd mstsc_title_bar/MstscTitleBar
dotnet run
To create a portable executable:
dotnet publish -c Release -r win-x64 --self-contained -p:PublishSingleFile=true
Real-World Use Cases
1. Multi-Environment Management
If you manage DEV/STAGE/PROD environments, color-code them:
- ๐ด Red = Production (danger zone)
- ๐ก Yellow = Staging (proceed with caution)
- ๐ข Green = Dev (break things freely)
2. Client Segregation
Consultants managing multiple clients can use patterns like:
{ "Pattern": "client-a", "Label": "Client A", "ColorHex": "#9b59b6" }
{ "Pattern": "client-b", "Label": "Client B", "ColorHex": "#f39c12" }
3. Datacenter Identification
Label servers by location:
{ "Pattern": "us-east", "Label": "๐บ๐ธ Virginia", "ColorHex": "#3498db" }
{ "Pattern": "eu-west", "Label": "๐ช๐บ Ireland", "ColorHex": "#2ecc71" }
Known Limitations
- Windowed Mode Only: Full-screen RDP hides the toolbar (by design).
- Windows 10/11: Uses WinAPI calls specific to modern Windows.
- Refresh Delay: 3-second polling interval (configurable in code).
Want to contribute? PRs welcome!
Conclusion
If you've ever typed rm -rf / in the wrong terminal or restarted the wrong server, you know the value of visual cues. RDP Title Master is a simple, zero-configuration tool that makes your daily workflow safer.
Try it out and let me know what you think in the comments!
GitHub: https://github.com/mlanies/mstsc_title_bar
Have you built tools to prevent "production accidents"? Share your stories below!
Top comments (0)