Digressive / HyperV-Backup-Utility

Flexible Hyper-V Backup Utility
https://gal.vin/posts/vm-backup-for-hyper-v/
MIT License
120 stars 38 forks source link

Old Backup Files are not being removed. #10

Closed RJ-Make closed 2 years ago

RJ-Make commented 2 years ago

OS: Windows 10 Pro

Problem: Old Backup Files are not being removed. I do see "2021-10-16 01:09:00 [INFO] Removing compressed backups of NextCloud_G2 older than: 3 days" in the logs.

What debug info do you need?

Digressive commented 2 years ago

Hi there,

Please let me know what the names of the vms you are backing are, and the full string you are using to run the script.

RJ-Make commented 2 years ago

Sorry for the delay.

Here is the requested info.

VM Name: NextCloud_G2

Batch-file Contents: REM Hyper-V Virtual Machine Backup set WorkingDir=G:\Hyper-V_BU_WrkDir set BackUpTheseVMs=C:\FTPSyncFiles\Bat_Files\VM_BU_SCRIPTS\hosts.txt set BackupLocation=A:\ServerFolders\Acronis_Comp_BU\NextCloud_VM\BU\GEN_2 set BackupLogLocation=A:\ServerFolders\Acronis_Comp_BU\NextCloud_VM\BU\Logs set PowerShellScriptLoc=C:\FTPSyncFiles\Bat_Files\VM_BU_SCRIPTS\VMStartStop.ps1

PowerShell -ep bypass %PowerShellScriptLoc% -BackupTo %BackupLocation% -List %BackUpTheseVMs% -Wd %WorkingDir% -Keep 3 -Compress -L %BackupLogLocation%

Digressive commented 2 years ago

Hey there, sorry for the wait - I've been testing and tweaking the script. Unfortunately, I can't replicate the issue.

The script deletes old backups based off the CreationTime reported, so perhaps something is changing that, or it's not being recorded properly?

I have updated the script so it reports what files it will delete. Hopefully this will help with finding the problem on your end.

RJ-Make commented 2 years ago

Thank You for all your hard work on this, I will update today and report back.

RJ-Make commented 2 years ago

Running into some problems using the lastest version.

`At C:\FTPSyncFiles\Bat_Files\VM_BU_SCRIPTS\VMStartStop.ps1:1217 char:28

RJ-Make commented 2 years ago
2021-10-31_11-40-04
Digressive commented 2 years ago

Hi there, Sorry about that!

If you download the most recent version (I updated last night) it should work without those errors you posted.

RJ-Make commented 2 years ago

Perhaps I'm doing something wrong, as I'm getting the same errors.

Here is the new scripts I copied just now. VMStartStop.zip

2021-11-01_17-51-11
Digressive commented 2 years ago

Just found the issue - there is a difference in the encoding of the script that you have. Did you copy & paste it from github into a txt file? If so, that's where the issue is coming from.

If you download as a zip from GutHub (under the Green "Code" button) then you'll get the script without the encoding issue.

RJ-Make commented 2 years ago

Sorry for the delay,

That was it. Thank You! I'll report back on the deletion issue now that you solved my stupidity.. :-)

Digressive commented 2 years ago

No problem at all!

I've been looking at the script today and believe I have fixed the issue you were having, so please check out the latest version: 21.11.05

RJ-Make commented 2 years ago

It appears your prev. version was indeed cleaning up the old back ups. I have downloaded (correctly this time :-) ) this new version and will test and report back.

RJ-Make commented 2 years ago

Latest version has solved the removal of old backup's.

Thanks again for all your hard work.

Digressive commented 2 years ago

No problem, glad your problem is fixed! Thanks again