It’s no surprise that most Veeam customers live with one or two Veeam Backup and Replication consoles – hey, it’s easier to manage, easier to report on, and easier to upgrade come update time if you keep your footprint to a minimum. That said, I’m not most customers I have multiple Veeam B&R consoles – not necessarily because I have to, but it’s a preference – It allows me to split out functionality and services, I can have a self contained DR site, and I can also instantiate local backup functionality at multiple sites, leaving them to be non reliant on the main datacenter. It’s working for me but there’s one caveat – come update time it’s a real big pain having to go out and click through a wizard 20 or so times.
Needless to say I was quite thrilled when I saw the following within the v8 update 2 release notes….
w00t! No more wizard driven day of click craziness for me. After getting a little bit of help from Anton Gostev in the forums (if you have been in the Veeam forums you know this guy) I was off to the races in my automated install.
The command
Installing Veeam Update 2 silently is basically done in two steps; first we need to unpack the files from the installer and second we simply execute the HotFixRunner.exe file with the proper arguments. Anton suggested placing both steps with at batch file so in the end I was left with something like such (setup.bat)…
1 2 3 |
mkdir c:\VeeamData\v8\unpacked ”c:\VeeamData\v8\VeeamBackup&Replication_8.0.0.2021_Update2.exe” /Q /C /T:c:\VeeamData\v8\unpacked c:\VeeamData\v8\unpacked\HotFixRunner.exe silent noreboot log C:\VeeamData\v8\patch.log VBR_AUTO_UPGRADE=1 |
Basically save all the above within setup.bat, obviously changing your directory names to the where you copied the VeeamBackup&Replication_8.0.0.2021_Update2.exe file and where you want the files unpacked. From there you simply execute setup.bat and sit back and relax while Veeam updates…
But that’s not enough for me
What about copying the update file out to the B&R servers? What about copying setup.bat out? We still need to do this and I for one don’t want to manually do anything . This could very easily be achieved with PowerShell or your tool of choice – but in the case I decided to lean on my good ol’ friend vRealize Orchestrator to do the trick. Mainly because I’m sitting in the vSphere Web Client for a good chunk of the day and having the functionality right at my fingertips just seemed proper. That, and every single one of my Veeam B&R servers are virtualized. Another reason is because I’d like to expand on the workflow someday, giving it the ability to cancel any currently running Veeam jobs, report back on success, etc.. vRO through the use of PowerShell and REST plug-ins gives me all of this building-block functionality. If your Veeam B&R console isn’t virtualized or you don’t want to automate with vRO go ahead and copy the files out using whatever tool you like and execute them – it’ll work just the same.
But if you want to dabble around in vRO or just want something a little more challenging go ahead and create a new workflow – The workflow I built performs three main functions; copies the update file, copies the setup file, and then executes the setup file – pretty simple.
As far as inputs and attributes this is the way I went about it. For inputs I used only three, the VM name (this is the VBR instance I’ll be upgrading) and a username and password with permission to copy and execute on the file system.
The rest of the information that the workflow needs will be stored in workflow attributes as it will always be static throughout all the installs and upgrades I’ll perform. In my case I used four attributes (shown below) defining the file paths on both the vRO server and the Veeam server for the setup.bat file and the Veeam update executable.
Once these are defined it’s time to setup our workflow schema – Drag two scriptable tasks onto the schema editor and label them “Copy Files to VBR Server” and “Execute Setup.bat” or something more to your liking.
The Copy Files scriptable task handles the copying of both the Veeam update and setup.bat file. Thankfully most the scripting for copying a file has already been completed and is stored inside a default vRO workflow titled “Copy File from vCO to Guest”. I simply copied the script out of this workflow, pasted into my scriptable task and modified slightly to suit my needs. You can see my final script along with a screen cap of the bindings so you can get a better understanding of which attributes/parameters need to be mapped into the scriptable task shown below. If you run into some trouble, mainly permission issues have a look at this post by Nick Coyler which greatly helps with that issue.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
var host = vm.sdkConnection; var guestOperationsManager = host.guestOperationsManager; var guestAuth = new VcNamePasswordAuthentication(); guestAuth.username = vmUsername; guestAuth.password = vmPassword; var fileManager = guestOperationsManager.fileManager; result = false; var attr = new VcGuestFileAttributes(); var srcFile = new File(vroPathToSetup); var uri = fileManager.initiateFileTransferToGuest(vm , guestAuth ,guestPathToSetup, attr, srcFile.length, true); result = fileManager.putFile(vroPathToSetup, uri); var attr2 = new VcGuestFileAttributes(); var srcFile2 = new File(vroPathToVeeam); var uri2 = fileManager.initiateFileTransferToGuest(vm , guestAuth ,guestPathToVeeam, attr2, srcFile2.length, true); result = fileManager.putFile(vroPathToVeeam, uri2); |
From here we move onto the “Execute setup.bat” scriptable task. Again this script was borrowed and modified slightly from the “Run program in guest” workflow that is shipped with vRO – the script and screencap of attribute/parameters are shown below
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
var host = vm.sdkConnection; var guestOperationsManager = host.guestOperationsManager; var guestAuth = new VcNamePasswordAuthentication(); guestAuth.username = vmUsername; guestAuth.password = vmPassword; guestAuth.interactiveSession = false; var guestProgramSpec = new VcGuestProgramSpec(); guestProgramSpec.programPath = guestPathToSetup; guestProgramSpec.arguments = ""; guestProgramSpec.workingDirectory = ""; var processManager = guestOperationsManager.processManager; result = processManager.startProgramInGuest(vm , guestAuth , guestProgramSpec); |
And we are done…
Pretty simple right – once you have saved your workflow you can go ahead and execute it right away. Or if you prefer, map the workflow within the vSphere Web Client to your VM inventory object – allowing you to simply right-click a Veeam B&R server and execute the script all without having to leave the web client. Either way you are left with a quick, easy, and consistent way to upgrade all of your B&R servers without ever having to log into them – achievement unlocked
Keep in mind
- You can only use this for virtualized Veeam servers – any physical servers could be automated, but you may need to chose another tool to do the copying and executing of the files
- You need to ensure that no jobs are running when you perform the upgrade – This is something I’d love to build into the workflow but just need time (story of my life) – for now, manually cancel any currently running Veeam jobs before executing the workflow
- The workflow reports success right away, before the upgrade is complete – again, I need time for this one. For now, you can monitor the patch.log file that setup.bat creates – it should say something along the lines of exit code 0 returned when the upgrade as completed…
Happy update day!