PlexBackup icon indicating copy to clipboard operation
PlexBackup copied to clipboard

what is my syntax error?

Open naddel91 opened this issue 1 year ago • 20 comments

thanks for your script. but I cannot make it work. it does not execute after powershell command it entered. is it due to my custom folders?

plex script

naddel91 avatar Oct 12 '24 08:10 naddel91

  1. When you define the setting in the configuration file, you need to assign them to the value properties, not to the default properties under the _meta element (these just show what the default values are). So, just move values from lines 23 and 29 to lines 25 and 30 (replace null values with your values).
  2. Which version of PowerShell are you using? From PowerShell window, run $PSVersionTable and it will show the version. If you are using version 7, then it's probably the reason. It did not work for me and I did not have time to port the script to PowerShell 7 (it's on the todo list, but no promises at this point)
  3. If you are running PowerShell 5.x, please post a screenshot of what happens and we'll go from there.

alekdavis avatar Oct 12 '24 19:10 alekdavis

thanks for your help. still nothing:

nothing

$PSVersionTable says 5.1

naddel91 avatar Oct 12 '24 20:10 naddel91

I think you have a typo in the BackupRootDir setting (unless you intentionally called the folder Backu).

That's not how you run PowerShell scripts. First, move the PlexBackup.ps1 file somewhere to a dedicated directory, so it is not mingled with other application or data files. I would recommend creating a separate folder. If you insist on using the K drive, just go to the root of the K drive and create a PlexBackup folder and move the PlexBackup.ps1 and PlexBackup.ps1.json files there. Then from PowerShell command prompt, switch to this folder so it is your active directory and enter .\PlexBackup.ps1. This should work.

alekdavis avatar Oct 12 '24 20:10 alekdavis

P:\Backu is intentional. My P-Key did hang when I created that folder. So I named it that in the script. ".\PlexBackup.ps1" or ".\PlexBackup.ps"?

naddel91 avatar Oct 12 '24 20:10 naddel91

Sorry, ps1. It was my typo.

alekdavis avatar Oct 12 '24 20:10 alekdavis

Backup.log

naddel91 avatar Oct 12 '24 20:10 naddel91

Do you have 7zip installed?

alekdavis avatar Oct 12 '24 20:10 alekdavis

yes, and set to PATH as well.

naddel91 avatar Oct 12 '24 20:10 naddel91

Did you specify the path to the 7zip EXE in the in the config file?

alekdavis avatar Oct 12 '24 20:10 alekdavis

"}, "Type": { "_meta": { "set": ",7zip,Robocopy", "default": """

here?

naddel91 avatar Oct 12 '24 21:10 naddel91

No, under:

"ArchiverPath": {
        "_meta": {
            "default": "$env:ProgramFiles\\7-Zip\\7z.exe"
        },
        "value": ""HERE!!!"
    },

alekdavis avatar Oct 12 '24 21:10 alekdavis

I have the default dir, so no value needed, right?

naddel91 avatar Oct 12 '24 21:10 naddel91

7zip

naddel91 avatar Oct 12 '24 21:10 naddel91

7zip2

The .exe file is definetely there!

naddel91 avatar Oct 12 '24 21:10 naddel91

If it's the default installation dir, then, no, not needed (and if you specify it, it must include the exe file). But the log indicates that it fails to archive the first (Cache) directory (I assume you have no files to archive under the root folder, which is normally the case). So, normally, 7zip should provide some info why it failed, but in your case, I see nothing. So, it's really weird. I would run it with the -Verbose switch to see if there is any additional info. You can also try the default archiver (do not use the switch to indicate 7zip compression) and see if it does better. If I ran into this problem, I would add a log statement before line 2992 and print out the command the script uses and try to run it manually. Or try compressing the cache folder via 7zip by hand.

alekdavis avatar Oct 12 '24 21:10 alekdavis

can I leave out cache folder? I thought it would be excluded by default?

naddel91 avatar Oct 12 '24 21:10 naddel91

According to your screenshot, 7-zip path should be under C:\Programme\7-zip\7z.exe, not under C:\Program Files\7-zip\7z.exe. But I suspect it would not matter (since the default did not cause this error).

alekdavis avatar Oct 12 '24 21:10 alekdavis

You can exclude the Cache folder, but it is important: it stores all of you custom configurations. You can exclude it as a troubleshooting step (to see if it may be locked or something), but I would not exclude it for normal operation.

alekdavis avatar Oct 12 '24 21:10 alekdavis

ok, will backup with "-verbose" and report back tomorrow. thanks for your time.

naddel91 avatar Oct 12 '24 21:10 naddel91

OK. Also, run it with the -RawOutput switch. Maybe it will give us additional info from 7zip.

alekdavis avatar Oct 12 '24 22:10 alekdavis

I assume this issue was resolved. If not, reopen it.

alekdavis avatar Dec 09 '24 03:12 alekdavis