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

Test-Connection fails #9

Closed
rawtaz opened this issue Feb 16, 2020 · 4 comments
Closed

Test-Connection fails #9

rawtaz opened this issue Feb 16, 2020 · 4 comments

Comments

@rawtaz
Copy link

rawtaz commented Feb 16, 2020

I've followed the installation instructions and am running stuff as an administrator, but noticed that the scheduled task didn't start properly. Turned out that it's due to this (the following is from a manual run in an administrator PS shell, to see the errors):

PS C:\restic> .\backup.ps1
Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

Test-Connection : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
At C:\restic\backup.ps1:235 char:42
+         elseif(!(Test-Connection -Server $repository_host -Quiet)) {
+                                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.TestConnectionCommand

WARNING: Errors found! Error Log: C:\restic\logs\20200216T2334197164.err.txt
Something went wrong. Sleeping for 15 min and then retrying...

I'm using the following config (it's for a repository on a rest-server):

# restic backup repository configuration
$Env:AWS_ACCESS_KEY_ID=''
$Env:AWS_SECRET_ACCESS_KEY=''
$Env:RESTIC_REPOSITORY='rest:https://user:[email protected]/user'
$Env:RESTIC_PASSWORD='password'

I did see the comment in https://github.com/kmwoley/restic-windows-backup/blob/master/backup.ps1#L216 and am guessing it's the string parsing that doesn't work properly.

Is this something you could fix easily or is it a more long-term issue? I realize that a fix should preferrably be backend-agnostic, which isn't very straight-forward.

For now I'll just hardcoded the proper hostname into that variable.

@kmwoley
Copy link
Owner

kmwoley commented Feb 17, 2020 via email

@flicksolutions
Copy link

I have the same error using an SFTP connection.
I would be glad if you could look into this.

@flicksolutions
Copy link

As a quickfix:
I just set the variable $repository_host to the IP-Adress/Hostname of my SFTP-Server.
So i just replaced Line 220 of backup.ps1 to the following:

    $repository_host = <MY HOSTNAME/IP>

@kmwoley
Copy link
Owner

kmwoley commented Apr 29, 2020

I'll get a fix for this pretty shortly; the internet connectivity check didn't handle all repo types. It will in the next release. Thanks for letting me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants