Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to setup task #40

Open
si458 opened this issue May 6, 2021 · 10 comments
Open

unable to setup task #40

si458 opened this issue May 6, 2021 · 10 comments
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested

Comments

@si458
Copy link

si458 commented May 6, 2021

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?

@kmwoley
Copy link
Owner

kmwoley commented May 7, 2021

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

@si458
Copy link
Author

si458 commented May 7, 2021

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
Copy link
Author

si458 commented May 23, 2021

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>

@kmwoley
Copy link
Owner

kmwoley commented Nov 15, 2021

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!

@si458
Copy link
Author

si458 commented Nov 15, 2021

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

@SLiX69
Copy link

SLiX69 commented Apr 1, 2022

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.

@kmwoley
Copy link
Owner

kmwoley commented Jan 15, 2023

@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 kmwoley added bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Jan 15, 2023
@killmasta93
Copy link

hi @kmwoley currently im having the same issue

@rkl110
Copy link

rkl110 commented Nov 22, 2023

@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.

@geozavl
Copy link

geozavl commented Apr 6, 2024

The same issue on standalone Windows Server 2012 R2 Standard

Helps the following fix of principal in install script:

    $task_user = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount -RunLevel Highest

Thanks to https://stackoverflow.com/questions/13965997/powershell-set-a-scheduled-task-to-run-when-user-isnt-logged-in and ChatGPT ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants