Solution for Automatically Managing (deleting) TeslaCam footage from Windows PC (or network drive) #824
alexmereness
started this conversation in
Show and tell
Replies: 1 comment
-
Thanks, thats helpful! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I put together a simple Windows PowerShell script that automatically deletes TeslaCam footage over a specified age (days) from a Windows computer or connected network drive. The script helps address video storage management from TeslaCam/TeslsaUSB. This script is setup with easy-to-use variables that can be adjusted to fit your environment. You can configure the script to be run daily (or whatever frequency) using Windows Task Scheduler. I'm sure there are many different ways to go about this or improvements that could be made, but this seemed to address my needs, so I figured I'd share. For most, this should be quite simple to implement. If you make any useful adjustments, please share!
Note: This script is provided as-is, with no warranty. Use at your own risk.
You can configure the following:
Setup Steps:
Copy script text below into text file and save script as "TeslaCamCleanup.ps1" on the computer that will launch the script.
Use a text editor (Notepad, NotePad++, etc.) to customize the script for your environment. To customize this script, you can adjust the following variables: "$maxAge" (How long to keep files), "rootDirectory" (file path of 'TeslaCam' directory),"$logFilePath" (location and name of log file), and "$subDirectories" (Subdirectories within the 'TeslaCam' folder to search).
To run PowerShell script on Windows, you may need to configure the PowerShell ExecutionPolicy. Open PowerShell as Administrator and enter the following command: "Set-ExecutionPolicy Unrestricted". Select "A" for 'all' when prompted.
Setup a Windows scheduled task with Task Scheduler. Here are task configurations I use: Task Trigger: "Daily" (or pick your frequency).
Windows Task Scheduler Configuration:
End Result Example: "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe C:\Tesla\TeslaCamCleanup.ps1"
**Note: Be sure to setup your task with Administrator Privileges and configure to run whether user is logged in or not. **
TeslaCamCleanup.ps1 Script:
Beta Was this translation helpful? Give feedback.
All reactions