Skip to content

bug: Recording stops when user launches a process as administrator (UAC Secure Desktop) #88

@J-MaFf

Description

@J-MaFf

Describe the bug

When the recorded user (dpuerner or any target user) launches an application as administrator during a session, the recording file ends prematurely at that point.

Root Cause

This is caused by the UAC Secure Desktop (Winsta0\Winlogon). When Windows shows the elevation prompt ("Do you want to allow this app to make changes..."), it temporarily switches from the user's normal desktop (Winsta0\Default) to a separate, isolated secure desktop.

gdigrab -i desktop holds an OS handle to Winsta0\Default. When the switch occurs, that handle becomes invalid and FFmpeg exits with code 0 (a clean exit, not a crash code) — stopping the recording at exactly the moment UAC fires.

Note: The exit code being 0 is important. A fix based on checking for non-zero exit codes would not catch UAC-triggered exits and would incorrectly treat them as graceful logoffs.

Impact

Any elevated action (right-click → Run as administrator, installers, UAC prompts) will silently end the recording. For Dina's iKAT error capture use case, if the error occurs after an elevation prompt, the recording will be missing the relevant footage.

Steps to Reproduce

  1. Log on as the target user
  2. Confirm recording is active (C:\Recordings has a growing .ts file)
  3. Right-click any application → Run as administrator
  4. Observe the UAC prompt
  5. Check C:\Recordings — the .ts file has stopped growing; a new file is NOT started

Proposed Fix

Add a restart loop to Invoke-iKATRecording.ps1. Instead of the script exiting when FFmpeg exits, it should check if the current user session is still active and, if so, start a new FFmpeg instance with a new timestamped output file.

# Pseudocode
while ($userSessionActive) {
    $outputFile = "$TargetUser_session_$(Get-Date -Format 'yyyyMMdd_HHmmss').ts"
    Start-FFmpeg -OutputFile $outputFile
    Wait-ForFFmpegToExit
    # If we're still logged in, loop and start a new recording segment
}

This means a single session could produce multiple .ts files (e.g., one before the UAC prompt, one after), but no footage is permanently lost.

Acceptance Criteria

  • Launching an elevated process does not permanently stop the recording
  • A new .ts file is automatically started after FFmpeg exits mid-session
  • Recording continues until the user actually logs off (not just until the next elevation prompt)
  • Each segment file is named with a timestamp so segments are distinguishable

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions