Skip to content

Instantly share code, notes, and snippets.

View joshooaj's full-sized avatar

Josh Hendricks joshooaj

View GitHub Profile
@joshooaj
joshooaj / New-VmsCarouselView.ps1
Last active January 11, 2026 03:00
Create carousel views for XProtect Smart Client
#Requires -Modules MilestonePSTools
<#
.SYNOPSIS
Creates a Smart Client view containing one or more camera carousel view items.
.DESCRIPTION
The New-VmsCarouselView script automates the creation of Milestone XProtect Smart
Client views containing carousel view items. A carousel view item automatically
rotates through a list of cameras at a specified interval, displaying each camera
for a set duration before moving to the next.
@joshooaj
joshooaj / procdump.ps1
Last active January 8, 2026 22:39
PowerShell script to schedule and create memory dumps using procdump
#Requires -RunAsAdministrator
<#
.SYNOPSIS
Creates memory dumps using procdump.exe with automatic compression and retention management.
.DESCRIPTION
This script captures memory dumps of a specified process using Sysinternals procdump.exe,
compresses them into ZIP archives, and manages retention by keeping only the most recent dumps.
@joshooaj
joshooaj / PSBeets.psm1
Created September 4, 2025 19:20
A mix of PowerShell functions for working with my music library. Work in progress...
$script:itemFields = @'
acoustid_fingerprint
acoustid_id
added
album
album_id
albumartist
albumartist_credit
albumartist_sort
albumdisambig
@joshooaj
joshooaj / generate-decade-playlists.ps1
Created September 4, 2025 19:09
Generate "Best Of Decade" smart playlists for Navidrome
param(
[Parameter()]
[int]
$MinYear = 1960,
[Parameter()]
[int]
$MaxYear = 2020,
[Parameter()]
@joshooaj
joshooaj / ReplaceUnknownHardware.ps1
Last active July 16, 2025 21:20
Find hardware in XProtect with an unrecognized driver and change to a new driver
Get-VmsRecordingServer | ForEach-Object {
$rec = $_
# Clear cached info about the hardware and drivers on the current recorder
$rec.HardwareDriverFolder.ClearChildrenCache()
$rec.HardwareFolder.ClearChildrenCache()
# Cache all the available drivers on the current recording server
$drivers = @{}
$rec | Get-VmsHardwareDriver | ForEach-Object {
$drivers[$_.Path] = $null
@joshooaj
joshooaj / self-signed-certs.ps1
Last active July 8, 2025 22:55
Example of generating self-signed certificates signed by a self-signed root certificate
# Generate a self-signed certificate to use as a root certificate
$rootParams = @{
# Subject can be any valid X.500 distinguished name
Subject = 'CN=MyRootCA'
# The key may only be used for signing certificates
KeyUsage = 'CertSign'
# FriendlyName is optional but useful for identifying the cert in a list
FriendlyName = 'My Root CA'
# Save certificate and private key in the "Local Computer\Personal" store
CertStoreLocation = 'Cert:\LocalMachine\My'
@joshooaj
joshooaj / install-pwsh.sh
Last active July 3, 2025 00:09
Install PowerShell on linux
#!/bin/bash
# This script is a slightly modified version of the install script shared by
# by Mike F. Robbins on September 26th, 2024.
# Url: https://mikefrobbins.com/2024/09/26/how-to-install-powershell-7-and-essential-tools-on-linux/
# Determine the system architecture
ARCH=$(dpkg --print-architecture)
# Downloads use x64 instead of amd64 now
@joshooaj
joshooaj / DevicePermissions.psm1
Last active July 1, 2025 23:51
Export and import XProtect VMS device permissions
#requires -Module MilestonePSTools
function Export-DevicePermissions {
<#
.SYNOPSIS
Export all device permissions for a given role to a JSON file.
.DESCRIPTION
Export all device permissions for a given role to a JSON file. Note that
this does not include the Overall Security permissions or other settings.
@joshooaj
joshooaj / Get-AlarmHistory.ps1
Last active June 21, 2025 16:31
Get the alarm update history for an alarm by ID
#requires -Module MilestonePSTools
<#
.SYNOPSIS
Get the update history for an XProtect VMS alarm by ID
.DESCRIPTION
This function retrieves the update history for a specific alarm on an
XProtect VMS based on the provided alarm ID. The alarm ID is the number
shown in the ID column in XProtect Smart Client.
@joshooaj
joshooaj / Get-LineEnding.ps1
Last active May 29, 2025 21:16
Find files with specific line endings or mixed line endings
function Get-LineEnding {
<#
.SYNOPSIS
Returns the line ending found in a given file.
.DESCRIPTION
Returns a [PSCustomObject] with a `LineEnding` property with the value
'CRLF', 'LF', or 'MIXED' depending on the line endings found in the file.
.EXAMPLE