Added readme and snapshot script
This commit is contained in:
parent
301dd14ff6
commit
24b3bff27e
2 changed files with 35 additions and 0 deletions
26
VMSSnapshooter.ps1
Normal file
26
VMSSnapshooter.ps1
Normal file
|
|
@ -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
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue