'This script downloads a backup from vera 'Lars Sundberg - automatiserar.se 'Option explicit 'For debugging On error resume next Dim VeraIP, VeraHttpPath, VeraUserName, VeraPassword, VeraBackupDir, VeraFileName, VeraSavePath, debugg 'Customize your connection here VeraIP = "127.0.0.1" 'Can also be dns name. VeraUserName = "11223344" VeraPassword = "Password" VeraBackupDir = "C:\temp\" 'Always end with \ 'Debug information. Debugg = 0 'If debugg = 1 then run the script with cscript.exe from cmd.exe to get more debugg infomation. Else Run it with Debugg = 0. If debugg = 1 then Wscript.echo "[Connection] VeraIP = " & VeraIP If debugg = 1 then Wscript.echo "[Connection] VeraUserName = " & VeraUserName If debugg = 1 then Wscript.echo "[Connection] VeraPassword = " & VeraPassword If debugg = 1 then Wscript.echo "[Connection] VeraBackupDir = " & VeraBackupDir 'Let get it on VeraHttpPath = "http://" & Veraip & "/cgi-bin/cmh/backup.sh?external=1" VeraFileName = "Vera.Backup-" & Date VeraSavePath = VeraBackupDir & VeraFileName 'Join to complete path with file name If debugg = 1 then Wscript.echo "[HTTP] VeraHttpPath = " & VeraHttpPath If debugg = 1 then Wscript.echo "[HTTP] VeraSavePath = " & VeraSavePath Dim objHTTP Set objHTTP = CreateObject("MSXML2.XMLHTTP") 'Create HTTP object objHTTP.Open "GET", VeraHttpPath, False, VeraUserName, VeraPassword objHTTP.Send If debugg = 1 then Wscript.echo "[HTTP] Connection Status = " & objHTTP.Status Dim ObjFSO Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create file system object If objFSO.FileExists(VeraSavePath) Then If debugg = 1 then Wscript.echo "[FileSystem] File Exists! Deleting file..." objFSO.DeleteFile(VeraSavePath) 'This will delete file if it already exists. End If If objHTTP.Status = 200 Then 'The request has succeeded. Dim objStream Set objStream = CreateObject("ADODB.Stream") 'Creating object for database abstraction library. With objStream .Type = 1 'AD Type Binary .Open .Write objHTTP.ResponseBody .SaveToFile VeraSavePath 'Saveing file .Close End With set objStream = Nothing End If 'Error handling if debugg = 1 if err.number = 0 then If debugg = 1 then Wscript.echo "[Quit] All is OK and DONE!" else If debugg = 1 then Wscript.echo "[Quit] Ohh no, something went wrong! Status: " & err.number & " " & err.description end if Wscript.quit 'Quit script