Closed UfukYKO closed 1 year ago
Hi @UfukYKO,
Sure, those timestamps would cover the full 24 period of the previous day starting at midnight. Here's how I would normally do it so that I don't have to put in zeros for hours/minutes/seconds/milliseconds:
$end = (Get-Date).Date
$start = $end.AddDays(-1)
Or, if it's important that the datetime for $end
be just before midnight, I would subtract an extra millisecond:
$start = (Get-Date).Date.AddDays(-1)
$end = $start.AddDays(1).AddMilliseconds(-1)
Exporting a 24-hour period for all cameras can be done, but depending on the total number of cameras I might advise to break the export into groups of cameras. In any case, here's how you might do that export:
# Get all enabled cameras
$cameras = Get-VmsCamera
# Get start/end time timestamps representing the full 24 hours of the previous day
$start = (Get-Date).Date.AddDays(-1)
$end = $start.AddDays(1).AddMilliseconds(-1)
# Create exports folder on the desktop. Using Environment.GetFolderPath lets us get the real desktop path in case it is mapped to one-drive
$path = Join-Path -Path ([environment]::GetFolderPath([Environment+SpecialFolder]::Desktop)) -ChildPath 'Exports\'
$null = New-Item -Path $path -ItemType Directory -Force
# Export all cameras to Desktop\Exports\ with the date in the export folder name
Start-Export -Format DB -CameraIds $cameras.Id -StartTime $start -EndTime $end -Path $path -Name "$($start.ToString('yyyy-MM-dd'))_All-Cameras"
Hi Josh,
Is there a keyword or a way to export all cameras with this script? Like * To export a 24h footage from the cameras, will this modification work for the relevant lines: