Skip to content

Instantly share code, notes, and snippets.

View joshooaj's full-sized avatar

Josh Hendricks joshooaj

View GitHub Profile
//------------------------------------------------
//--- 010 Editor v16.0.4 Binary Template
//
// File: MediaDB-Block-File-Template.bt
// Authors: Josh Hendricks
// Version: 0.1
// Purpose: Parse XProtect video stream packets
// Category:
// File Mask:
// ID Bytes:
@joshooaj
joshooaj / README.md
Last active June 30, 2026 21:15
Sample PowerShell functions for configuring external login providers with support for cert-based auth

External Login Provider Sample Functions (POC)

This document explains how to use the sample functions in poc.ps1:

  • Invoke-MipRestApi
  • Get-MipLoginProvider
  • New-MipLoginProvider
  • Set-MipLoginProvider

These are proof-of-concept helper functions for working with external login provider configuration through the XProtect API Gateway.

@joshooaj
joshooaj / Get-ViewReport.ps1
Last active May 11, 2026 21:58
Get a report of which cameras are in which views on an XProtect VMS
function Resolve-VmsViewGroupPath {
[CmdletBinding()]
[MilestonePSTools.RequiresVmsConnection()]
param(
[Parameter(Mandatory, ValueFromPipeline)]
[Alias('DeviceGroup')]
[MilestonePSTools.ValidateVmsItemType('ViewGroup')]
[VideoOS.Platform.ConfigurationItems.IConfigurationItem]
$Group
)
@joshooaj
joshooaj / Beginners-Guide-To-H26x.md
Created March 17, 2026 17:08
Copilot-generated technical explanation of H.26x for beginners

A Beginner’s Guide to H.26x Video Streams

The Big Picture (Start Here)

An H.26x video stream is:

A time‑ordered series of compressed pictures, plus instructions describing how to decode them, packaged in a way that works for files, networks, and live streaming.

When debugging, you are usually asking one of these questions:

@joshooaj
joshooaj / Export-RawVideo.ps1
Last active March 16, 2026 18:47
Save raw video data from an XProtect VMS to disk
#requires -Modules MilestonePSTools
<#
.SYNOPSIS
Exports raw video data from a camera on a Milestone XProtect VMS to a file.
.DESCRIPTION
Retrieves recorded video frames from a Milestone XProtect recording server
using the RawVideoSource API and writes the raw compressed frame data to a
file. By default, the 32-byte VMS GenericByteData headers are stripped,
@joshooaj
joshooaj / ProcessWatcher.ps1
Created March 11, 2026 23:43
Watch for new processes and write information about them to the terminal
# This just writes text to the terminal with Write-Host and isn't useful for long-term monitoring or logging or automation
$job = Register-CimIndicationEvent -Query "SELECT * FROM __InstanceCreationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_Process'" -SourceIdentifier ProcessWatcher -Action {
param($sender, $e)
$p = $e.NewEvent.TargetInstance
Write-Host "`n---------`n"
Write-Host "Process: $($p.Name)"
Write-Host "ProcessId: $($p.ProcessId)"
Write-Host "Path: $($p.Path)"
Write-Host "CommandLine:"
@joshooaj
joshooaj / Rename-MediaDBTables.ps1
Created February 27, 2026 02:58
Rename XProtect media database tables by replacing the old device id with a new id in folder and config.xml files.
<#
.SYNOPSIS
Replace an old device ID with a new ID in a media database folder
.DESCRIPTION
If you have old XProtect recordings that you want to be able to playback in
XProtect, but the old recordings were made under a different device ID than
your cameras have now, you MIGHT be able to use this script to replace the
old device ID with the new device ID.
Before using this, you should have a secure backup of the recordings you want
@joshooaj
joshooaj / DllDirectoryManager.psm1
Last active February 7, 2026 20:24
Easily call the SetDllDirectory Win32 API function from PowerShell
function addDllDirectoryManager {
$csharp = @'
using System;
using System.Text;
using System.Runtime.InteropServices;
public static class DllDirectoryManager
{
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetDllDirectory(string lpPathName);
@joshooaj
joshooaj / PSMouseControl.psm1
Last active May 21, 2026 11:36
A little PowerShell module for moving, clicking, and scrolling the mouse on Windows
$typeDef = @'
using System;
using System.Runtime.InteropServices;
using System.Threading;
namespace PSMouseControl
{
struct FIXED
{
public short fract;
@joshooaj
joshooaj / extended-camera-report.ps1
Created January 16, 2026 17:29
Extend the output of Get-VmsCameraReport with Axis Zipstream properties
Get-VmsCameraReport | ForEach-Object {
$row = $_
$camera = Get-VmsCamera -Id $row.Id
$stream = $camera | Get-VmsCameraStream -RecordingTrack Primary
$settings = 'ZFpsMode', 'ZGopLength', 'ZGopMode', 'ZStrength'
foreach ($setting in $settings) {
$splat = @{
MemberType = 'NoteProperty'
Name = $setting
Value = $stream.Settings.$setting