From 24b3bff27efaa2133f25fb386181a8b0db686428 Mon Sep 17 00:00:00 2001 From: Frank Weggelaar Date: Wed, 31 Jul 2024 11:52:27 +0200 Subject: [PATCH] Added readme and snapshot script --- README.md | 9 +++++++++ VMSSnapshooter.ps1 | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 README.md create mode 100644 VMSSnapshooter.ps1 diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fc81d6 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +#Milestone Script Repo +Various Milestone VMS scripts +Provided AS-IS without support. YMMV. + +##VMSCertRoller +Milestone XProtect VMS Mobile SSL Certificate replacer. Used for RMM based deployment. + +##VMSSnapshooter +Makes snapshots of all online VMS camera's at a set date. Used to automate creation of reference images. \ No newline at end of file diff --git a/VMSSnapshooter.ps1 b/VMSSnapshooter.ps1 new file mode 100644 index 0000000..ee9e10a --- /dev/null +++ b/VMSSnapshooter.ps1 @@ -0,0 +1,26 @@ +# Get Hardware from VMS +$hardwarelist = Get-VmsCamera +$ext = ".jpg" + +# Loop through the Cameralist +foreach ($camera in $hardwarelist) { + $file = $camera.Name + $ext + try { + if ($file -match "^(.*?-.*?)-") { + $result = $matches[1] + $path = "C:\snaps\" + $result + If(!(test-path -PathType container $path)) { + $null = New-Item -ItemType Directory -Path $path + } + } + } catch { + Write-Host "Failed to match pattern" + } + # Match HardwareID and make snapshot + try { + $null = Get-Snapshot -CameraId $camera.Id -Timestamp "Thursday, June 27, 2024 01:00:00 AM" -Save -Path $path -Quality 100 -FileName $file + Write-Host "Saving as:" $file + } catch { + Write-Host "Failed to fetch snapshot for Camera ID:" $camera.HardwareId + } + } \ No newline at end of file