This example backups Thunderbird profiles to precreated network share. It can be added to task scheduler. It sends net message to current user if network share does not exist.
$name="user"
$backupDir = "\\server\backup\workstations"
$backupFolder = $backupDir + "\" + $name + "\"
$date = get-date -Format ddd
echo $backupFolder
echo $env:APPDATA/Thunderbird
cd $env:APPDATA/Thunderbird
if (-Not (Test-Path -Path $backupFolder)) {
msg.exe $env:UserName "Path[$backupFolder] not found, unable to backup"
return 0x10
}
if (-Not (Test-Path -Path $backupFolder$date)) {
New-Item -Path "$backupFolder$date" -ItemType Directory
}
else
{
echo "Path: $backupFolder$date already exists, skipping"
}
Copy-Item "Profiles/*" -Recurse -Destination $backupFolder$date -Force
No comments:
Post a Comment