Here a script is not executed under Windows. The file D:\Kopia\after.ps1 exists.
error running non-essential action command: exec: "C:\\Users\\OLIVER~1\\AppData\\Local\\Temp\\kopia-action2665930733\\powershell -WindowStyle Hidden D:\\Kopia\\after.ps1": file does not exist
Could it be that something is not working in the script? It is the script for shadow copies under Windows:
At “After folder” I have entered this:
powershell -WindowStyle Hidden D:\Kopia\after.ps1
If I start CMD and go to any folder and then start powershell.exe, it always starts Powershell, so in PATH it should be the right one.
I’m having the same issue, I even used the full path to powershell (C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe C:\path\to\script.ps1) and I’m still getting “file does not exist”. The error seems to be related to kopia, as pasting the above into cmd.exe works fine.
Ok after some time I figured out that it is an issue with setting the command in KopiaUI. When using the CLI to set the actions as described in the docs (Actions | Kopia) it works fine. The CLI splits the arguments, using the first one as the “command” and the subsequent ones as the “arguments”. But KopiaUI doesn’t do this, instead taking the whole string as the “command” despite there being no field for the arguments.
Hm… I don’t really understand. Did you find a solution or does it not work with UI?
Thanks for your support!
It doesn’t work correctly in the UI. If you click on the “Other” section in the Policy, you will see that “path” variable (in JSON) set to the full whole command you entered in the UI.
However if you use the following command and restart KopiaUI, you will see that JSON representation has the variable “path” set to “powershell” and “args” set to “C:\path\to\scripts\before.ps1”.
"C:\Program Files\KopiaUI\resources\server\kopia" --config-file=<path to config file> policy set --before-folder-action "powershell C:\path\to\scripts\before.ps1" "<Policy Name>"