restic-windows-backup icon indicating copy to clipboard operation
restic-windows-backup copied to clipboard

unable to setup task

Open si458 opened this issue 4 years ago • 10 comments

Hi All, im not able to create the scheduledtask via the install.ps1, i just keep getting an error?

Register-ScheduledTask : The parameter is incorrect.
At C:\restic\install.ps1:52 char:9
+         Register-ScheduledTask $backup_task_name -Action $task_action
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (PS_ScheduledTask:Root/Mi
   dTask], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Register-ScheduledTask

any suggestions?

si458 avatar May 06 '21 15:05 si458

Can you share your configuration? It would help to know what parameters are being passed to the command to debug.

kmwoley avatar May 07 '21 14:05 kmwoley

its just the standard setup with the items set in secret.ps1 like user/pass server etc, changed nothing, will try to get it for you soon, out at mo sorry

si458 avatar May 07 '21 14:05 si458

Hi @kmwoley, forgive my long delay, im not doing anything special Server 2012 R2, up to date

  1. downloaded the repo and extracted to C:\restic
  2. changed the config.ps1
# backup configuration
$ExeName = "restic.exe"
$InstallPath = "C:\restic"
$ResticExe = Join-Path $InstallPath $ExeName
$StateFile = Join-Path $InstallPath "state.xml"
$WindowsExcludeFile = Join-Path $InstallPath "windows.exclude"
$LocalExcludeFile = Join-Path $InstallPath "local.exclude"
$LogPath = Join-Path $InstallPath "logs"
$LogRetentionDays = 30
$InternetTestAttempts = 10
$GlobalRetryAttempts = 4
# maintenance configuration
$SnapshotMaintenanceEnabled = $true
$SnapshotRetentionPolicy = @("--group-by", "host", "--keep-daily", "30", "--keep-weekly", "52", "--keep-monthly", "24", "--keep-yearly", "10")
$SnapshotPrunePolicy = @("--max-unused", "1%")
$SnapshotMaintenanceInterval = 7
$SnapshotMaintenanceDays = 30
$SnapshotDeepMaintenanceDays = 90;
# email configuration
$SendEmailOnSuccess = $false
$SendEmailOnError = $false
# Paths to backup
$BackupSources = @{}
$BackupSources["C:\"] = @(
    'MyFiles'
)
#$BackupSources["D:\"] = @(
#    'Software'
#)
  1. copied secret_template.ps1 to secret.ps1 and edited it
# restic backup repository configuration
$Env:AWS_ACCESS_KEY_ID='MYLONGID'
$Env:AWS_SECRET_ACCESS_KEY='MYLONGKEY'
$Env:RESTIC_REPOSITORY='s3:https://mybackups.server.com/MYBUCKET/MYFOLDER'
$Env:RESTIC_PASSWORD='password'
# email configuration
$PSEmailServer='<SMTP SERVER>'
$ResticEmailConfig=@{UseSsl=$true; Port="587"}
$ResticEmailTo='<DESTINATION EMAIL ADDRESS>'
$ResticEmailFrom='<FROM EMAIL ADDRESS>'
$ResticEmailUsername='<EMAIL LOGIN USERNAME>'
$ResticEmailPassword='<EMAIL PASSWORD>'
  1. added the [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 to install.ps1 to allow downloading of the restic.zip
  2. then run powershell as admin, and then cd C:\restic then .\install.ps1 which generates a success but never actually successed?
PS C:\restic> .\install.ps1
Fatal: create key in repository at s3:https://mybackups.server.com/MYBUCKET/MYFOLDER failed:
repository master key and config already initialized

WARNING: [[Init]] Repository initialization failed. Check errors and resolve.
Register-ScheduledTask : The parameter is incorrect.
At C:\restic\install.ps1:52 char:9
+         Register-ScheduledTask $backup_task_name -Action $task_action ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (PS_ScheduledTask:Root/Microsoft/...S_ScheduledTask) [Register-Schedule
   dTask], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070057,Register-ScheduledTask

[[Scheduler]] Backup task scheduled.
PS C:\restic>

si458 avatar May 23 '21 19:05 si458

Can you tell me what language your computer is localized to? There's another issue posted recently that as me wondering if there's a localization issue with the script. Thanks!

kmwoley avatar Nov 15 '21 04:11 kmwoley

Can you tell me what language your computer is localized to? There's another issue posted recently that as me wondering if there's a localization issue with the script. Thanks!

Just English United Kingdom

si458 avatar Nov 15 '21 07:11 si458

Same error for me on 2012R2, different language. No error on Server 2019, maybe a Windows 8(.1) specific issue.

Exporting the task on Server 2019 and importing on 2012R2 works.

SLiX69 avatar Apr 01 '22 17:04 SLiX69

@si458 @SLiX69

Hey folks - I've left this issue open hoping for other folks to chime in and see if they've run into the issue, and hopefully found a fix. Did any of you ever find a solution here?

I don't really want to close this issue, but I don't have a way to test or get to the bottom of this issue without additional help debugging from someone who can reproduce the issue.

kmwoley avatar Jan 15 '23 05:01 kmwoley

hi @kmwoley currently im having the same issue

killmasta93 avatar Oct 26 '23 03:10 killmasta93

@killmasta93 on my system nothing started, the problem is, the SYSTEM user is not the SYTEM user. Please try to select the right user in task scheduler dialog settings.

rkl110 avatar Nov 22 '23 14:11 rkl110