# OBS Replay Buffer for IT Support IT support tool that runs OBS Studio's replay buffer silently on VDI sessions, giving users a system tray button to save the last N minutes of screen activity when an issue occurs. Clips are saved to a central UNC share organized by username. ## How It Works 1. DEM runs `Start-OBSReplayBuffer.ps1` as a logon task 2. The script validates all required project files are accessible, then deploys OBS config files to `%APPDATA%\obs-studio\` automatically 3. OBS launches hidden with the replay buffer running — users never see the OBS interface 4. A system tray icon appears — right-click → **Save Replay** 5. The clip saves to `\\server\ITCaptures\\YYYY-MM-DD_HH-MM-SS.mkv` ## Architecture | Component | Role | |---|---| | **DEM Logon Task** | Runs `Start-OBSReplayBuffer.ps1` at logon — only DEM task required | | **`config.psd1`** | Central config — UNC path, buffer duration, OBS executable path | | **`Start-OBSReplayBuffer.ps1`** | Validates project files, deploys OBS config, creates user capture folder, writes OBS profile, launches OBS + tray icon | | **`Show-ReplayTray.ps1`** | WinForms system tray icon — right-click menu with Save Replay / Exit | | **`Invoke-ReplaySave.ps1`** | Sends `SaveReplayBuffer` to OBS via WebSocket v5 (built into OBS 28+) | | **`obs-config/`** | OBS config files — deployed to `%APPDATA%\obs-studio\` at logon by the script | ## Repository Structure ``` obs-replay-buffer/ ├── config.psd1 ├── scripts/ │ ├── Start-OBSReplayBuffer.ps1 │ ├── Show-ReplayTray.ps1 │ └── Invoke-ReplaySave.ps1 └── obs-config/ ├── global.ini ├── scenes/ │ └── ITMonitor.json └── plugin_config/ └── obs-websocket/ └── config.json ``` ## Prerequisites - **OBS Studio 28+** — delivered via App Volumes AppStack **or** installed directly on the machine (WebSocket v5 is built in — no plugin needed) - **VMware DEM** to run the logon task - A **UNC share** writable by VDI users for clip storage - A **network share** to host this repo's files, accessible from all VDI machines > **App Volumes is optional.** If OBS Studio is installed directly on the machine (e.g. via SCCM, Intune, or manual install), App Volumes is not required. Set `OBSExecutable` in `config.psd1` to the correct path and the script will work as-is. ## Configuration Edit `config.psd1` before deploying: | Key | Description | Default | |---|---|---| | `UNCPath` | Base UNC path for clip storage — username subfolder created automatically | `\\server\ITCaptures` | | `LogPath` | Directory path for script logs — supports `%USERNAME%` and other environment variables; each script writes its own log file | `\\server\ITLogs\%USERNAME%` | | `BufferSeconds` | Replay buffer duration in seconds | `120` | | `WebSocketPort` | OBS WebSocket port — must match `obs-config/plugin_config/obs-websocket/config.json` | `4455` | | `OBSExecutable` | Full path to `obs64.exe` on the target machine | `C:\Program Files\obs-studio\bin\64bit\obs64.exe` | | `ProfileName` | OBS profile name — must match the folder under `obs-config/profiles/` | `ITMonitor` | | `SceneCollection` | OBS scene collection name — must match the filename under `obs-config/scenes/` | `ITMonitor` | ## Deployment ### Step 1 — Host the repo on a network share Place this repo (or a copy of it) on a share accessible from all target machines, e.g.: ``` \\stcu-fs01\IT-Tools\OBS-Record\ ``` ### Step 2 — DEM: Logon task Create one logon task in DEM (scoped to the target user group). Set it to **not wait for completion**. ``` powershell.exe -ExecutionPolicy Bypass -NonInteractive -WindowStyle Hidden -File "\\stcu-fs01\IT-Tools\OBS-Record\scripts\Start-OBSReplayBuffer.ps1" ``` This is the only DEM task needed. The script handles all config file deployment, folder creation, and launching both OBS and the tray icon. It will exit cleanly (code 1) if any required project file is inaccessible, or exit 0 if OBS is already running. > **No DEM file transfer tasks are needed.** The script deploys `global.ini` and the WebSocket config from the repo to `%APPDATA%\obs-studio\` at each logon. `basic.ini` is written dynamically so the correct UNC path and primary monitor resolution are baked in per session. ### Step 3 — OBS Studio (App Volumes or native install) **Option A — App Volumes:** Assign the OBS AppStack to the same user group. **Option B — Native install:** Ensure OBS Studio 28+ is installed at the path set in `OBSExecutable` in `config.psd1`. No other configuration is needed. ## User Experience - A shield icon appears in the system tray at logon — no other UI is visible - Right-click the icon → **Save Replay** to save the last `BufferSeconds` of screen activity - A Windows toast notification confirms success or failure (falls back to a message box if toast is unavailable) - Clips appear at `\\server\ITCaptures\\` named by timestamp - Logs are written to `\\server\ITLogs\\` — three files, one per script: - `OBSReplayBuffer.log` — startup and config deployment - `OBSReplayBuffer-Tray.log` — tray lifetime, save attempts, and results - `OBSReplayBuffer-Save.log` — WebSocket steps for each save attempt ## Changing the Buffer Duration Update `BufferSeconds` in `config.psd1`. The value is written into the OBS profile at each logon, so no repackaging or redeployment is needed. ## Notes ### Scene Collection JSON The `obs-config/scenes/ITMonitor.json` file was generated to target monitor index `0` (primary display). If it does not capture correctly on first use: 1. Launch OBS normally on a test machine 2. Manually configure a Display Capture source pointed at the primary monitor 3. Save, then copy `%APPDATA%\obs-studio\basic\scenes\ITMonitor.json` back into this repo ### OBS Tray Icon vs. IT Tray Icon OBS places its own tray icon when minimized. Users will see two icons — the OBS icon and the IT Screen Recorder shield icon. The OBS icon can be right-clicked to quit OBS, which would break the replay buffer. If this is a concern, a future enhancement could suppress the OBS tray icon via an OBS config setting.