Work around Windows UIPI blocking pywinauto from controlling a UAC-elevated application

domain: pywinauto.readthedocs.io · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Diagnose the symptom first: an elevated target app whose windows pywinauto can see via Desktop().windows() but can't reliably click or send input to, or that errors with an invalid-window-handle-style failure, is a strong UIPI signature
  2. Confirm the integrity-level mismatch by checking whether the target app was launched elevated (shows a UAC shield or was started via Run as administrator) while your Python process was not
  3. Run the pywinauto script itself elevated, for example by launching the terminal/IDE as Administrator, so both processes share the same integrity level
  4. Where elevating the whole script isn't desirable, isolate elevation to a small elevated launcher process and keep the bulk of the automation logic in a non-elevated caller
  5. For CI/service accounts, ensure the account driving pywinauto has matching elevation for both the target app's launch and the automation process, since scheduled/service-launched apps can end up elevated without an interactive UAC prompt

Known gotchas

Related routes

Choose between pywinauto's win32 and uia backends for a given Windows application
pywinauto.readthedocs.io · 5 steps · unrated
Automate Windows desktop applications from Python using pywinauto
pywinauto.readthedocs.io · 5 steps · unrated
Fix flaky pywinauto waits by tuning Timings and using wait_for instead of fixed sleeps
pywinauto.readthedocs.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans