Files
OBS-Replay-Buffer-for-IT-Su…/README.md
2026-03-27 11:16:39 -07:00

130 lines
5.9 KiB
Markdown

# 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 assigns this to targeted users at logon via App Volumes (OBS) + file transfer + logon task
2. OBS launches hidden with the replay buffer running — users never see the OBS interface
3. A system tray icon appears — right-click → **Save Replay**
4. The clip saves to `\\server\ITCaptures\<username>\YYYY-MM-DD_HH-MM-SS.mkv`
## Architecture
| Component | Role |
|---|---|
| **App Volumes AppStack** | Delivers OBS Studio to targeted VDI sessions |
| **DEM File Transfer** | Drops OBS config files into `%APPDATA%\obs-studio\` at logon |
| **DEM Logon Task** | Runs `Start-OBSReplayBuffer.ps1` at logon |
| **`config.psd1`** | Central config — UNC path, buffer duration, OBS executable path |
| **`Start-OBSReplayBuffer.ps1`** | 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 profile, scene collection, and WebSocket config delivered by DEM |
## Repository Structure
```
obs-replay-buffer/
├── config.psd1
├── scripts/
│ ├── Start-OBSReplayBuffer.ps1
│ ├── Show-ReplayTray.ps1
│ └── Invoke-ReplaySave.ps1
└── obs-config/
├── global.ini
├── profiles/
│ └── ITMonitor/
│ └── basic.ini
├── scenes/
│ └── ITMonitor.json
└── plugin_config/
└── obs-websocket/
└── config.json
```
## Prerequisites
- **OBS Studio 28+** packaged as an App Volumes AppStack (WebSocket v5 is built in — no plugin needed)
- **VMware App Volumes** to deliver OBS to targeted users
- **VMware DEM** to deliver config files and 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
## Configuration
Edit `config.psd1` before deploying:
| Key | Description | Default |
|---|---|---|
| `UNCPath` | Base UNC path for clip storage — username subfolder created automatically | `\\server\ITCaptures` |
| `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 VDI 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 VDI machines, e.g.:
```
\\stcu-fs01\IT-Tools\OBS-Record\
```
### Step 2 — DEM: File Transfer tasks
Create these file transfer tasks in DEM, scoped to the target user group. All run at logon.
| Source (on network share) | Destination (on VDI session) |
|---|---|
| `obs-config\profiles\ITMonitor\` | `%APPDATA%\obs-studio\basic\profiles\ITMonitor\` |
| `obs-config\scenes\ITMonitor.json` | `%APPDATA%\obs-studio\basic\scenes\ITMonitor.json` |
| `obs-config\plugin_config\obs-websocket\config.json` | `%APPDATA%\obs-studio\plugin_config\obs-websocket\config.json` |
| `obs-config\global.ini` | `%APPDATA%\obs-studio\global.ini` |
> **Note:** `basic.ini` is intentionally not delivered by DEM — it is written dynamically at logon by `Start-OBSReplayBuffer.ps1` so that the correct UNC path (including username) and primary monitor resolution are baked in per session.
### Step 3 — DEM: Logon task
Create one logon task in DEM (scoped to the same target 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 script handles launching both OBS and the tray icon — no second task needed.
### Step 4 — Assign App Volumes AppStack
Assign the OBS AppStack to the same user group in App Volumes. The logon task will exit cleanly if OBS is not present or already running.
## 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 balloon notification confirms success or failure
- Clips appear at `\\server\ITCaptures\<username>\` named by timestamp
## Changing the Buffer Duration
Update `BufferSeconds` in `config.psd1`. The value is written into the OBS profile at each logon, so no repackaging of the App Volumes AppStack 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 with the AppStack assigned
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
The `basic.ini` and WebSocket config are reliable and should not need adjustment.
### OBS Tray Icon vs. IT Tray Icon
OBS itself also places a tray icon when minimized to tray. 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 hide the OBS tray icon via a startup flag or OBS config setting.