Hi all,
How do you upgrade a BackupAssist installation? Well, up until now, the answer has been: manually.
But one of our Aussie helpdesk team, Aaron, has done a great job in writing a VB script that will download the latest BackupAssist installation to a temp directory, uninstall the old version and install the new version – thereby performing an automated upgrade.
We’ve tested this on a variety of machines – SBS 2003, Vista, XP, Server 2008, and SBS 2008 – and it has worked for us. Now it’s time to turn it over to the community and get some feedback on this.
To run the script – save the text below to a vbs file – say BAUpgrader.vbs – and then run it from the command prompt:
cscript BAUpgrader.vbs
Make sure you’re running the command prompt as the Administrator user, with elevated rights if you have UAC turned on.
If you have any feedback, please post a comment below. We have not yet tested it with management software like Kaseya – but if you’d like to give it a go (in a non-production environment!) please feel free.
Also note that this is a BETA script, so the usual disclaimers apply.
—- BEGIN SCRIPT BELOW – FOR ALL INSTALLATIONS APART FROM SERVER CORE AND HYPER-V SERVER —-
—- Note: this script is subject the same EULA as BackupAssist —-
sTarget = “C:\temp”
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
If Not objFSO.FolderExists(sTarget) Then
objFSO.CreateFolder(“c:\temp”)
End If
strFileURL = “http://www.backupassist.com/downloads/releases/latest/BackupAssistV5.msi”
strHDLocation = “c:\temp\BackupAssistV5.msi”
Set objXMLHTTP = CreateObject(“MSXML2.XMLHTTP”)
objXMLHTTP.open “GET”, strFileURL, false
objXMLHTTP.send()
If objXMLHTTP.Status = 200 Then
WScript.StdOut.Write “Downloading the latest version of BackupAssist…” & VbCrLf & VbCrLf
Set objADOStream = CreateObject(“ADODB.Stream”)
objADOStream.Open
objADOStream.Type = 1 ‘adTypeBinary
objADOStream.Write objXMLHTTP.ResponseBody
objADOStream.Position = 0
Set objFSO = Createobject(“Scripting.FileSystemObject”)
If objFSO.Fileexists(strHDLocation) Then objFSO.DeleteFile strHDLocation
Set objFSO = Nothing
objADOStream.SaveToFile strHDLocation
objADOStream.Close
WScript.StdOut.Write “Download complete” & VbCrLf & VbCrLf
Set objADOStream = Nothing
End if
Dim installer
Set installer = CreateObject(“WindowsInstaller.Installer”)
strTempProdCode = “”
For Each strProductCode In installer.Products
If installer.ProductInfo(strProductCode, “InstalledProductName”) = “BackupAssist v5” Then
strTempProdCode = strProductCode
End If
Next
set fso = Wscript.CreateObject(“Scripting.FileSystemObject”)
If Not strTempProdCode = “” Then
If fso.FileExists(“C:\Temp\BackupAssistV5.msi”) Then
Dim objShell
strTemp = strTempProdCode & ” /passive”
Set objShell = CreateObject(“WScript.Shell”)
objShell.Run “%comspec% /c msiexec /x ” & strTemp _
& “& msiexec /package c:\temp\BackupAssistV5.msi /passive”
WScript.StdOut.Write”Automated update was successful”
WScript.Quit
Else WScript.StdOut.Write”The BackupAssist update did not download. The automated update was unsuccessful”
End If
Else
WScript.StdOut.Write “BackupAssist is not currently installed on this machine!”& VbCrLf &”Automatic updating not available!” & VbCrLf & VbCrLf
End If
7 thoughts on “Unattended upgrade script – BETA”
Silly question.
What about adding on the ability to send an email once its run.
That way it could be set as a scedualed task on servers, then alert people once its ran and what its done..
Here’s my attempt at a Kaseya script. I’ve ran it on a few servers and it seems OK.
*** Use at your own risk ***
Any feedback suggestions welcomed.
Script Name: UpgradeBA_V5
Script Description: This script checks for the existence of BackupAssist V5 and if present, downloads the current installation file and installs.
IF Test File
Parameter 1 : C:\Program Files\BackupAssist v5\BackupAssist.exe
Exists :
THEN
Get Variable
Parameter 1 : 10
Parameter 2 :
Parameter 3 : temp
OS Type : 0
Get URL
Parameter 1 : http://www.backupassist.com/downloads/releases/latest/BackupAssistV5.msi
Parameter 2 : #temp#\BackupAssistV5.msi
Parameter 3 : 3
OS Type : 13
Execute Shell Command
Parameter 1 : msiexec /i #temp#\BackupAssistV5.msi /passive
Parameter 2 : 1
OS Type : 13
Write Script Log Entry
Parameter 1 : BackupAssist upgraded on machine #machineID#
OS Type : 13
ELSE
Write Script Log Entry
Parameter 1 : Inappropriate attempt to upgrade BackupAssist on machine #machineID#
OS Type : 0
Hi everyone,
It’s come to our attention that copying/pasting the script from the blog post is changing the encoding of the characters – causing issues when compiling and running the script.
However; I’ve now uploaded a couple of .rar files containing the scripts to the BackupAssist website which you can just download and run the script without having to edit it at all. The links are as follows:
http://www.backupassist.com/support/RegularUpdate.rar
http://www.backupassist.com/support/ServerCoreUpdater.rar
Stuart Edwards
BackupAssist Support
Thanks for a script. I look for your backup software, and there is one strange thing I’ve noticed:
you have very simple user interface, and every newbie is able to back up his data, but this script seems to be for advanced users. Please create an .exe-file which performs upgrade manually!
Anyway, fine software!
Cheers
So we’ve moved away from Kaseya and I’m trying to deploy this with the vbs script but I’m getting “RegularUpdate.vbs(50, 6) Msi API Error: ProductInfo,Product,Attribute” in stderr.
Has something changed with the MSI since this was written?
Thanks.
I get the same error!
“RegularUpdate.vbs(50, 6) Msi API Error: ProductInfo,Product,Attribute”
Does this have a scheduled backup feature?
I tried this BackupAssist on my files on website to backup but I got an error RegularUpdate.vbs(50, 6) Msi API Error: ProductInfo,Product,Attribute