Hello, friends of the LB forum. Does anyone have a PowerShell script to save all specific LightBurn and machine settings?
Hello, friends of the LB forum. Does anyone have a PowerShell script to save all specific LightBurn and machine settings?
Just export a settings bundle directly from LightBurn:
Easy restoration, too.
Thank you for your reply; however, I already perform that procedure. I want to have the task executed by an automated script.
I wrote this small script to handle part of the task; the machine backups are still missing
@echo off
set “origem=%USERPROFILE%\AppData\Local\LightBurn”
set “destino=F:\LIGHTBURN\BACKUP\LightBurn_Backup_%date:~-4,4%%date:~-7,2%%date:~-10,2%”
xcopy “%origem%” “%destino%” /E /I /H /Y
echo LightBurn backup completed successfull!
pause
If you are talking about the machine preference backup files (.lbprefs), your origin path does not go deep enough. You may have to adjust the path for your specific file location or add a new script line with a Date restriction (my prefs folder currently has 250 files in it).
set “origem=%USERPROFILE%\AppData\Local\LightBurn\backup\prefs\"
To copy a Bundle file, you first have to first save one (.lbzip) somewhere. Then add that location to your backup process. I do not think there is an automatic save process for Bundles like there is for the Preference files.
The `/e` parameter in the `xcopy` command copies directories and subdirectories, including empty ones. It copies the entire structure starting from the provided path and then copies all the files within it. I am looking into copying via script to avoid using the LightBurn interface, but I haven’t yet managed to locate the Bundle files.
Because they do not automaticlly exist.
Have not used XCOPY in ages, so those switch memories are long gone. ![]()
Below is the PowerShell script that allows you to back up machine preference files (.lbprefs). I believe the script is now updated to reflect the current reality. kkkk
$LightBurnPrefs = “$env:USERPROFILE\appdata\local\LIGHTBURN\BACKUP”
$SourcePrefs = “$env:LOCALAPPDATA\LightBurn\backup”
$SourceLibraries = “$env:USERPROFILE\Documents\LightBurn”
$BackupFolder = “C:\Backups\LightBurn”
$Date = Get-Date -Format “yyyy-MM-dd”
$ZipPath = “$BackupFolder\LightBurn_Backup_$Date.zip”
if (!(Test-Path -Path $BackupFolder)) {
New-Item -ItemType Directory -Path $BackupFolder | Out-Null
}
$TempFolderName = “LB_Temp_” + (New-Guid).ToString(“N”)
$TempFolder = Join-Path -Path $env:TEMP -ChildPath $TempFolderName
New-Item -ItemType Directory -Path $TempFolder | Out-Null
if (Test-Path $SourcePrefs) {
Copy-Item -Path “$SourcePrefs*” -Destination $TempFolder -Recurse -Force
}
if (Test-Path $SourceLibraries) {
Copy-Item -Path “$SourceLibraries*” -Destination $TempFolder -Recurse -Force
}
Compress-Archive -Path “$TempFolder*” -DestinationPath $ZipPath -Force
Remove-Item -Path $TempFolder -Recurse -Force
Write-Host “Backup do LightBurn concluído com sucesso em: $ZipPath” -ForegroundColor Green