Skip to content

Instantly share code, notes, and snippets.

View joshooaj's full-sized avatar

Josh Hendricks joshooaj

View GitHub Profile
function Get-VmsCameraMotion {
<#
.SYNOPSIS
Gets the motion detection settings for one or more cameras.
.DESCRIPTION
The `Get-VmsCameraMotion` cmdlet gets the motion detection settings for one or more cameras. The MotionDetection
object for a camera can be accessed using $camera.MotionDetectionFolder.MotionDetections[0]. This command can be
considered a PowerShell-friendly shortcut for accessing these settings.
function Set-VmsDeviceStorage {
<#
.SYNOPSIS
Set the target storage configuration for a device in XProtect.
.DESCRIPTION
The `Set-VmsDeviceStorage` cmdlet sets the target storage configuration for a device in XProtect.
.PARAMETER Device
Tge one or more devices returned by the Get-VmsCamera, Get-Microphone, Get-Speaker, or Get-Metadata cmdlets.
@joshooaj
joshooaj / Compare-DHash.ps1
Last active March 14, 2024 16:15
Compare images using the dHash algorithm
function ConvertFrom-HexString {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 0, ValueFromPipeline)]
[string]
$InputObject
)
process {
$bytes = [byte[]]::new($InputObject.Length / 2)
@joshooaj
joshooaj / Watch-CameraStream.ps1
Last active February 22, 2024 23:12
Watch a live stream of XProtect camera stream properties including resolution, codec, fps, and bitrate.
function Watch-CameraStream {
<#
.SYNOPSIS
Stream the current video stream properties for the provided camera stream.
.DESCRIPTION
The `Watch-CameraStream` cmdlet uses MilestonePSTools and the MIP SDK to
retrieve the current video stream properties for the provided camera stream
from the recording server using the GetVideoDeviceStatistics method of the
@joshooaj
joshooaj / ConvertFrom-LenelCsv.ps1
Last active January 31, 2024 23:42
Import hardware in Milestone XProtect from a Lenel CSV file
# Copyright (c) Milestone Systems A/S.
# Licensed under the MIT License.
function ConvertFrom-LenelCsv {
<#
.SYNOPSIS
Convert a CSV export from from Lenel's migration tool into a CSV format for MilestonePSTools.
.DESCRIPTION
The `ConvertFrom-LenelCsv` cmdlet converts a CSV file created using Lenel's migration tool into a CSV format
@joshooaj
joshooaj / Get-VmsHotfixes.ps1
Created January 12, 2024 01:13
List available Milestone XProtect VMS Hotfix downloads
function Get-VmsHotfixes {
[CmdletBinding()]
param(
[Parameter()]
[string]
$Version
)
process {
@joshooaj
joshooaj / Start-HttpListener.ps1
Last active January 9, 2024 00:43
Start a simple local HTTP listener to receive test HTTP requests
function Start-HttpListener {
<#
.SYNOPSIS
Starts a local HTTP server and returns information about HTTP requests.
.DESCRIPTION
This function starts a local HTTP server, by default on http://localhost:10123/,
and returns information about the first HTTP request received.
To test this simple HTTP listener, try opening a second PowerShell session and
@joshooaj
joshooaj / MipItemCommands.ps1
Last active January 8, 2024 19:05
Get MIPKind and MIPItem objects using Configuration API commands in MilestonePSTools
function Get-MipKind {
<#
.SYNOPSIS
Gets all matching Milestone Integration Platform types or "Kinds".
.DESCRIPTION
The `Get-MipKind` cmdlet gets all matching Milestone Integration Platform
types or "Kinds". The term "Kind" in MIP integrations represents a type of
configuration object. Cameras for example have a "Kind" with the ID
'5135ba21-f1dc-4321-806a-6ce2017343c0', and both first and third party
@joshooaj
joshooaj / Set-VmsHardwarePtzSettings.ps1
Last active November 14, 2023 00:36
Configure PTZ settings on XProtect VMS Hardware objects with MilestonePSTools
function HandleValidateResultException {
[CmdletBinding()]
param(
[Parameter(Mandatory, ValueFromPipeline, Position = 0)]
[System.Management.Automation.ErrorRecord]
$ErrorRecord,
[Parameter()]
[object]
$TargetObject,
@joshooaj
joshooaj / README.md
Last active November 8, 2023 19:21
Use Pester to perform a basic network availability test on whatever app/service you want.

Service Availability Test

Introduction

This is a basic test harness using Pester with a JSON configuration file to describe and test the accessibility of any number of TCP ports on any number of host machines.

Usage

Edit services.json to describe the services you want to test by creating a named object record under Services, with a DisplayName string property, and a Ports array property with one or more TCP ports expressed as an integer: