PowerShell script exchange
Post Reply
quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 2:48 am 9 people like this post

Hey All,

I have seen dead forum posts in the past asking how to mass update Veeam with command line. As we maintain hundreds of veeam instances, doing the upgrade manually was not an option. Below is the solution we have created. Please chime in if anything here could be improved. One note in the code examples I provided. We utilize Kaseya to manage our devices, and its scripting engine has limitations. Particularly in that powershell, to be reliably used must be invoked through command line, and it heavily encourages massive gross one line commands. I apologize for some of the code spaghetti coming.

First problem: As documented here ( https://helpcenter.veeam.com/docs/backu ... l?ver=95u4 ), upgrading via command line is not an option. It must be uninstalled, and then installed. Not cool, but manageable.

Second problem: The documentation on how to install Veeam in unattended mode is functionally 100% incorrect. ( https://helpcenter.veeam.com/docs/backu ... l?ver=95u4 )
From having undocumented required MSI flags, to not mentioning huge pieces of what is needed, it took a lot of time to get a solution working.

Now let's jump into it!

1 - For our solution, Kaseya's native unpack functionality does not play nice with ISO's, so we extracted the ISO and repackaged it as a zip on dropbox. The first portion of the script creates a working directory and places both the zip and our licence file in said directory. The zip is then unpacked. As that code has our own links in it, I will not provide it.

2 - Backup the config of veeam in case it breaks.

Code: Select all

powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Start-VBRConfigurationBackupJob"
3 - Stop all running jobs cleanly.

Code: Select all

powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Get-VBRJob | ?{$_.GetLastState() -eq 'Working'} | Stop-VBRJob"
4 - If the shell is running, terminate it.

Code: Select all

Taskkill /IM veeam.backup.shell.exe /F
5 - Stop all Veeam services

Code: Select all

powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"
6 - Uninstall all software beginning with "Veeam" as it has multiple components

Code: Select all

powershell -command "$product = \"Veeam*\";$UninstallKeys = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall');$uninstallKeys = foreach ($key in (Get-ChildItem $UninstallKeys) ) {if ($key.GetValue(\"DisplayName\") -like \"$product\") {[pscustomobject]@{UninstallString = $key.GetValue(\"UninstallString\");}}};foreach ($key in $uninstallkeys) {$uninstallString = $key.UninstallString;if ($uninstallString.StartsWith('MsiExec.exe')) {$uninstallString = $uninstallString.replace('/I','/X') + ' /qb- /quiet /passive /norestart'} else {$uninstallString = ' '}& cmd /c $uninstallString}"
7 - This one is an as of yet unsolved Anomaly. When installing via the GUI, it drops SQL2016 in place. However in my script testing, it behaved identically if I dropped it in place or not. For now, this line is unused, however providing install code for posterity

Code: Select all

start /wait C:\temp\veeam9.5u4\Redistr\x64\SqlExpress\2016SP1\SQLEXPR_x64_ENU.exe /Q /ACTION=Install /FEATURES=SQL /INSTANCENAME=VEEAMSQL2016 /SQLSVCACCOUNT="NT AUTHORITY\SYSTEM" /SQLSYSADMINACCOUNTS="Builtin\Administrators" /AGTSVCACCOUNT="NT AUTHORITY\SYSTEM" /IACCEPTSQLSERVERLICENSETERMS
8 - Install the backup catalog

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs01Catalog.txt" /qn /i "C:\temp\veeam9.5u4\Catalog\VeeamBackupCatalog64.msi"  ACCEPT_THIRDPARTY_LICENSES="1"
9 - Install the Server

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs02Server.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Server.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="C:\Temp\YOURLICENCEHERE.lic" VBR_AUTO_UPGRADE="YES"
10 - Install the Shell

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs03Shell.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Shell.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"
11 - Install AD Explorer

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs04AD.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForActiveDirectory.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"
12 - Install Exchange Explorer

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs05Exchange.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForExchange.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"
13 - Install Oracle Explorer

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs06Oracle.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForOracle.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"
14 - Install Sharepoint Explorer

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs07Sharepoint.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForSharePoint.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"
15 - Install SQL Explorer

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs08SQL.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForSQL.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"
16 - Install Linux Agent Redistributable

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs09LinuxRedist.txt" /qn /i "C:\temp\veeam9.5u4\Packages\VALRedist.msi" ACCEPT_THIRDPARTY_LICENSES="1"
17 - Install Windows Agent Redistributable

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs10WindowsRedist.txt" /qn /i "C:\temp\veeam9.5u4\Packages\VAWRedist.msi" ACCEPT_THIRDPARTY_LICENSES="1"
18 - Ensure all Veeam services are started

Code: Select all

powershell -command "get-service -displayname *veeam* | foreach-object { Start-Service -InputObj $_.Name }"
19 - Re-Scan all the things

Code: Select all

powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Rescan-VBREntity -AllHosts -AllCloudProviders -AllRepositories -AllReplicas -Wait"
20 - Reboot.

I will probably be tweaking this over the coming days, but the big takeaway is that this is possible. The documentation Veeam provides is inaccurate to the point of being misleading, and the lack of a single flag in place upgrade option is highly disappointing. For an enterprise product, seems like quite the oversight! Also, having both undocumented and non uniform MSI flags was quite the challenge.

Have fun!

nielsengelen
Veeam Software
Posts: 2394
Liked: 510 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Mass Upgrade to 9.5u4

Post by nielsengelen » Jan 31, 2019 10:43 am 2 people like this post

Thanks a lot for sharing this! That is one amazing post! In regards to the documentation, I will pass the info along to have it modified/improved.
VCP-DCV
Veeam Certified Architect (VMCA)
http://foonet.be

anthonyspiteri79
Veeam Software
Posts: 533
Liked: 112 times
Joined: Jan 14, 2016 6:48 am
Full Name: Anthony Spiteri
Location: Perth, Australia
Contact:

Re: Mass Upgrade to 9.5u4

Post by anthonyspiteri79 » Jan 31, 2019 2:27 pm 1 person likes this post

That is amazing actually. I've got some ideas on how to reuse this in some of the work we have done with Terraform. Great stuff!
Anthony Spiteri
Global Technologist, Product Strategy | VMware vExpert
Email: anthony.spiteri@veeam.com | Mobile: +61488335699
Twitter: @anthonyspiteri | Skype: anthony_spiteri

tdewin
Veeam Software
Posts: 1380
Liked: 453 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Mass Upgrade to 9.5u4

Post by tdewin » Jan 31, 2019 4:19 pm 2 people like this post

One thing that you might consider is disabling the jobs as well (but then you would have to enable them as well). I guess it is a corner case, but there could be a moment where a job (re)start between stopping the running jobs and the uninstall

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 5:42 pm

For the documentation, the main things I found were
1) References to onedrive explorer, I couldn't even find a package for that in the media for u4, possibly an old component?
2) Required flag on the backup catalog not documented, results in error 1603 "third party check" when digging into the logs.
3) Just a lot of required packages not mentioned to install at all.

Also, from what I can tell, running an install through the GUI doesn't upgrade several components automatically, prompting for them to be upgraded on both the hypervisor and the Veeam server. Those components are installed ahead of time with this approach, avoiding that point of potential disruption.

As for Disabling, I had considered that. My assumption, proven out in admittedly limited testing thus far, is that if I cleanly stop jobs, terminate the shell process, and then terminate all services is that Veeam is unable to restart itself to fire off more jobs. If that is incorrect let me know. The reason I took that approach is that we occasionally have jobs already disabled for various reasons. So if I did a global disable, and then global re-enable, I may end up turning back on jobs that were purposely disabled for whatever reason. I am sure with time I could whip something up that dumps the names of jobs that are enabled prior to disabling, back that up to a txt file, and then use that to re-enable them. That said, unless my assumption about killing the services is incorrect, I have found that to be a much simpler solution. I have seen the services come up as each component is installed, perhaps re-killing any running veeam services after each install line would achieve a more reliable stop on jobs?

I have been discussing this with support as well, and from what they have sent me, the SQL install is optional assuming this is an in place upgrade from 9.5. The requirements for u4 are as follows ( https://helpcenter.veeam.com/docs/backu ... l?ver=95u4 ), and they should already be in place assuming this is being run as a fresh upgrade.

While I have not tested it, I would assume that doing a fresh install would require the sql2016 line as well.

Also an as of yet tested eventuality is backing up anything that uses agents or vmware. I will be testing those out over the next few days / weeks. Its possible they will have other components that require additions to my script. Thus far, all of my testing is assuming HyperV hosts for the machines being backed up.

For anyone looking to break apart installers like this, I highly recommend SuperOrca, a free utility that can be used to read MSI's ( http://www.pantaray.com/msi_super_orca.html )

In general, flags that can be passed to MSI's are in the properties table, however I found several instances of that not being the case here. For those, I ran a global search for terms like "accept" and "eula" to find what I needed.

nielsengelen
Veeam Software
Posts: 2394
Liked: 510 times
Joined: Jul 15, 2013 11:09 am
Full Name: Niels Engelen
Contact:

Re: Mass Upgrade to 9.5u4

Post by nielsengelen » Jan 31, 2019 5:49 pm 1 person likes this post

For point 1, the onedrive explorer is part of the sharepoint explorer install so we should clarify it.
VCP-DCV
Veeam Certified Architect (VMCA)
http://foonet.be

tsightler
VP, Product Management
Posts: 5296
Liked: 2147 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Mass Upgrade to 9.5u4

Post by tsightler » Jan 31, 2019 7:38 pm

quinnvanorder wrote:
Jan 31, 2019 2:48 am
But thats not all! If you just do this, the next time Veeam fires up, it will want you to upgrade components on your HyperV hosts as well. I have a script to deal with that as well.
Could you not just use the VBR_AUTO_UPGRADE option for the server install for this or is there some reason this did not work for you in your use case? That was exactly what it was intended to address, so if there are cases where it doesn't work that would be good information.

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 7:43 pm

According to the documentation, auto upgrade is not supported for V4

https://helpcenter.veeam.com/docs/backu ... l?ver=95u4

Check the bottom of the page. Admittedly I didn't test using this flag, I'll give it a shot now. If it works I will feel like a real goober, but I do try to read documentation and act accordingly prior to building stuff, so this may be a case of me being burned by documentation being incorrect :(

Testing now, will follow up shortly.
Automate all the things!

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 8:10 pm

Follow up - Yeah that doesn't work, it just opens the GUI and waits for user input.

Used the following string, which has worked on the past multiple versions:

C:\temp\Veeam9.5u4\setup.exe /silent /log C:\Logs\veeam.log VBR_AUTO_UPGRADE=1

It seems with major revisions, Veeam does not support a command line setup, I had to do similar reverse engineering for the jump from 9.0 to 9.5. Veeam hasn't managed to stop me yet! Clearly its possible, here is hoping future major version changes will support a command line upgrade feature to save us all this work :)
Automate all the things!

tsightler
VP, Product Management
Posts: 5296
Liked: 2147 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Mass Upgrade to 9.5u4

Post by tsightler » Jan 31, 2019 10:01 pm 1 person likes this post

Sorry for not being clear, I wasn't talking about running setup.exe, but when you install the server like above:

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs02Server.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Server.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="C:\Temp\YOURLICENCEHERE.lic"
You should be able to add VBR_AUTO_UPGRADE="YES" to this and it will automatically upgrade all components once service starts. This should eliminate the need to manually run the scripts to deploy to Hyper-V/Proxies/Repos etc as this option is supposed to automatically push out the component upgrades so you don't get the popup to upgrade components the first time you start the GUI after upgrade. That's why this option exist and I've used it in the past with no issues.

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 10:19 pm

Woah, solid tip, I am implementing that now, thanks! I suspect that removes a few steps from the primary script as well, as it puts the installer and mount services in place. I will update my post to reflect this once I have it all tested out.
Automate all the things!

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Jan 31, 2019 11:37 pm

Confirmed, so step 9 should be replaced with

Code: Select all

start /wait msiexec.exe /L*v "C:\temp\InstallLogs02Server.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Server.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="C:\Temp\YOURLICENCEHERE.lic" VBR_AUTO_UPGRADE="YES"
18 and 19 should be removed, and the entire second script becomes irrelevant.

Interestingly, I still get the false prompt to upgrade components that is cleared out by clicking refresh at first launch.

Thanks for the info tsightler
Automate all the things!

Gostev
SVP, Product Management
Posts: 24020
Liked: 3255 times
Joined: Jan 01, 2006 1:01 am
Location: Baar, Switzerland
Contact:

Re: Mass Upgrade to 9.5u4

Post by Gostev » Feb 01, 2019 2:49 am

Hi, Quinn. I've used my mod superpowers to edit your original post accordingly, now that you can no longer modify it based on the age. Please check if everything is correct, and let me know if any further edits are required. Thanks for sharing this gem!

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Feb 01, 2019 5:14 pm

Hey Gostev, it looks great, thanks for doing that!
Automate all the things!

quinnvanorder
Influencer
Posts: 13
Liked: 13 times
Joined: Jan 31, 2019 2:25 am
Full Name: Quinn Van Order
Location: Seattle WA
Contact:

Re: Mass Upgrade to 9.5u4

Post by quinnvanorder » Feb 19, 2019 10:26 pm 1 person likes this post

Update:

I have a few additions to this script now. I have found that each component, when installed, will turn on its corresponding services. As such, it can enable jobs to run midway through install which breaks all subsequent installs.

Previously, I had avoided disabling and enabling all jobs, as there may be cases where there is an old job in place which is disabled on purpose. Then doing a mass "enable all disabled jobs" could cause unexpected behavior. To address this, I took 2 paths simultaneously.

First, I use the code from Step 5 to stop all services between each install Steps 8 - 17

Second, I added code to export a csv with the names of all jobs that were enabled, read that csv into a variable and use it to first disable those jobs, and later to enable them. This ensures that any jobs that were disabled remain so, while making sure *all* jobs are disabled during install.

Third, I added "Veeam Distribution Service" to the list of installed components

Code below, assuming all needed component files are already downloaded and in the expected locations.

Code: Select all

#Backup Veeam Config
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Start-VBRConfigurationBackupJob"

#Stop all running Veeam Jobs
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Get-VBRJob | ?{$_.GetLastState() -eq 'Working'} | Stop-VBRJob"

#Disables all Veeam Jobs that were currently enabled. Writes target job list to CSV for resumption later. This avoids restarting jobs that were disabled prior to upgrade
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Get-VBRJob | where {$_.IsScheduleEnabled -eq $True} | select name | export-csv C:/temp/VeeamEnabledJobs.csv"
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Import-CSV C:/temp/VeeamEnabledJobs.csv | Disable-VBRJob -Job {$_.Name}"

#Terminate shell if running
Taskkill /IM veeam.backup.shell.exe /F

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Remove old Veeam instance
powershell -command "$product = \"Veeam*\";$UninstallKeys = @('HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall');$uninstallKeys = foreach ($key in (Get-ChildItem $UninstallKeys) ) {if ($key.GetValue(\"DisplayName\") -like \"$product\") {[pscustomobject]@{UninstallString = $key.GetValue(\"UninstallString\");}}};foreach ($key in $uninstallkeys) {$uninstallString = $key.UninstallString;if ($uninstallString.StartsWith('MsiExec.exe')) {$uninstallString = $uninstallString.replace('/I','/X') + ' /qb- /quiet /passive /norestart'} else {$uninstallString = ' '}& cmd /c $uninstallString}"

#Begin u4 installers. Each install starts some services. They are then stopped for each component upgrade to avoid jobs starting unexpectedly
Install Backup Catalog
start /wait msiexec.exe /L*v "C:\temp\InstallLogs01Catalog.txt" /qn /i "C:\temp\veeam9.5u4\Catalog\VeeamBackupCatalog64.msi"  ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Server
start /wait msiexec.exe /L*v "C:\temp\InstallLogs02Server.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Server.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1" VBR_LICENSE_FILE="C:\Temp\Veeam-200instances-entplus-monitoring.lic" VBR_AUTO_UPGRADE="YES"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Shell
start /wait msiexec.exe /L*v "C:\temp\InstallLogs03Shell.txt" /qn /i "C:\temp\veeam9.5u4\Backup\Shell.x64.msi" ACCEPTEULA="YES" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install AD Explorer
start /wait msiexec.exe /L*v "C:\temp\InstallLogs04AD.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForActiveDirectory.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Exchange Explorer
start /wait msiexec.exe /L*v "C:\temp\InstallLogs05Exchange.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForExchange.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Oracle Explorer
start /wait msiexec.exe /L*v "C:\temp\InstallLogs06Oracle.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForOracle.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Sharepoint Explorer
start /wait msiexec.exe /L*v "C:\temp\InstallLogs07Sharepoint.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForSharePoint.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install SQL Explorer
start /wait msiexec.exe /L*v "C:\temp\InstallLogs08SQL.txt" /qn /i "C:\temp\veeam9.5u4\Explorers\VeeamExplorerForSQL.msi" ACCEPT_EULA="1" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Linux Agent Redistributable
start /wait msiexec.exe /L*v "C:\temp\InstallLogs09LinuxRedist.txt" /qn /i "C:\temp\veeam9.5u4\Packages\VALRedist.msi" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Windows Agent Redistributable
start /wait msiexec.exe /L*v "C:\temp\InstallLogs10WindowsRedist.txt" /qn /i "C:\temp\veeam9.5u4\Packages\VAWRedist.msi" ACCEPT_THIRDPARTY_LICENSES="1"

#Stop all Veeam services
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"

#Install Veeam Distribution Service
start /wait msiexec.exe /L*v "C:\temp\InstallLogs11VeeamDistributionSvc.txt" /qn /i "C:\temp\veeam9.5u4\Packages\VeeamDistributionSvc.msi" ACCEPT_THIRDPARTY_LICENSES="1"

#Ensure Veeam services are started
powershell -command "get-service -displayname *veeam* | foreach-object { Start-Service -InputObj $_.Name }"

#Restart all jobs that were previously enabled
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Import-CSV C:/temp/VeeamEnabledJobs.csv | Enable-VBRJob -Job {$_.Name}"

#Post Install Cleanup
powershell.exe -nologo -executionpolicy bypass -noprofile -command " If(test-path 'C:\temp\veeam9.5u4'){Remove-Item 'C:\temp\veeam9.5u4' -Recurse -Force}" 
powershell.exe -nologo -executionpolicy bypass -noprofile -command " If(test-path 'C:\temp\VeeamEnabledJobs.csv'){Remove-Item 'C:\temp\VeeamEnabledJobs.csv' -Force}" 

#Re-Scan all repos
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Rescan-VBREntity -AllHosts -AllCloudProviders -AllRepositories -AllReplicas -Wait"

#Clean stop and Reboot
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Add-PSSnapin VeeamPSSnapin; Get-VBRJob | ?{$_.GetLastState() -eq 'Working'} | Stop-VBRJob"
powershell.exe -nologo -executionpolicy bypass -noprofile -command "Get-Service Veeam* | Stop-Service -Force"
shutdown -r -f -t 0
Automate all the things!

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests