26 lines
No EOL
881 B
PowerShell
26 lines
No EOL
881 B
PowerShell
# 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
|
|
}
|
|
} |