Skip to content

Instantly share code, notes, and snippets.

View joshooaj's full-sized avatar

Josh Hendricks joshooaj

View GitHub Profile
@joshooaj
joshooaj / PSMouseControl.psm1
Last active January 17, 2026 23:38
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
@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.