alekdavis / PlexBackup

PowerShell script to back up and restore Plex application data on a Windows system.
MIT License
178 stars 23 forks source link

what is my syntax error? #92

Open naddel91 opened 1 day ago

naddel91 commented 1 day ago

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

alekdavis commented 16 hours ago
  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.
naddel91 commented 16 hours ago

thanks for your help. still nothing:

nothing

$PSVersionTable says 5.1

alekdavis commented 15 hours ago

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.

naddel91 commented 15 hours ago

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"?

alekdavis commented 15 hours ago

Sorry, ps1. It was my typo.

naddel91 commented 15 hours ago

Backup.log

alekdavis commented 15 hours ago

Do you have 7zip installed?

naddel91 commented 15 hours ago

yes, and set to PATH as well.

alekdavis commented 15 hours ago

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

naddel91 commented 15 hours ago

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

here?

alekdavis commented 15 hours ago

No, under:

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

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

naddel91 commented 15 hours ago

7zip

naddel91 commented 15 hours ago

7zip2

The .exe file is definetely there!

alekdavis commented 15 hours ago

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.

naddel91 commented 15 hours ago

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

alekdavis commented 15 hours ago

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 commented 15 hours ago

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.

naddel91 commented 15 hours ago

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

alekdavis commented 13 hours ago

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