Windows/SQL Server 2008 Upgrade Automation for VMWare Cloud on AWS

Enables customers to automate upgrade of their Windows/SQL Server 2008 running in VMWare Cloud on AWS or on-premises vSphere environment

 

This PowerShell-based automation workflow can be used to upgrade SQL Server 2008 R2 VMs running in VMWare Cloud on AWS or vSphere environment in customer’s datacenter. With this automation, customers can clone the VM running SQL Server 2008 and upgrade it in an isolated environment, customers can trial run the upgrade and create runbooks for upgrading and testing their SQL Server 2008 fleets. The automation workflow creates a snapshot of the VM being upgraded so that customer can roll back the upgrade in case of upgrade failures.  The databases upgraded from the SQL 2008 R2 will be set to compatibility value of 100. Customers can change the compatibility values for individual databases after testing their applications if desired.

 

Customers can initiate the upgrade by pointing the PowerShell script to a SQL VM via the command line interface. The automation will execute SQL Server and Windows Server upgrade in an unattended mode. The automation first runs upgrade prerequisite checks and then performs upgrade of the Windows Server to Windows 2012 if the OS version is Windows 2008 and then upgrades the SQL Server. Customer needs to provide SQL installation media location and Windows Server installation media location for the upgrade.

 

We recommend customers first clone their SQL VM and upgrade the Cloned SQL VM without disturbing their production environment, test the upgrade, create runbooks, and then schedule downtime and upgrade the production SQL VM.

 

Setting Up

Prerequisites

In order to run the execute the upgrade automation, you must:

·       Mount the SQL Server 2016 Installation media to the VM being upgrade

·       Mount the Windows Server 2012 Installation media to the VM being upgrade if OS is running SQL 2008

·       Ensure the VM must have at least 20 GB of free disk space.

·       Ensure you have access to vCenter credentials as the upgrade automation works using the VMware APIs

·       Ensure you have administrator credentials to the VM being migrated.

 

Step 1: Install the Upgrade-WindowsAndSqlServer.ps1 PowerShell script

In order to run the Windows/SQL Server upgrade, download the PowerShell script, Upgrade-WindowsAndSqlServer.ps1.

 

Step 2: Install the VMware PowerCLI environment

The automation script requires a VMware PowerCLI environment, <<here>> is the instructions to install VMWare PowerCLI.

 

Getting Started

Accessing the Windows/SQL Server upgrade automation script for upgrading Windows and/or SQL Server databases.

 

The following parameters are used by the PowerShell script to upgrade your Windows and/or SQL Server databases.

 

-VSphereHostname

VMware vCenter hostname or IP address of the vCenter containing the VM to be upgraded.

-VSphereCredential

VMware vCenter login and password. If unset, the active vCenter connection will be used.

 

-VmId

Virtual machine managed object ID in vCenter of the VM to be upgraded.


-VmName

Virtual machine name in vCenter of the VM containing the Windows Server or SQL Server instance to be upgraded.

 

-VmGuestOsCredential

The script will prompt for the OS credentials of the VM being upgraded

 

-WindowsSetupExePath

Path to Windows Server installation media setup.exe file in the virtual machine's Windows guest OS.  If not set, Windows Server upgrade is skipped.

 

-WindowsProductKey

Windows Server product key.
       

-SqlSetupExePath

Path to SQL Server installation media setup.exe file in the virtual machine's Windows guest OS.

 

-SqlProductKey

SQL Server product key. Leave unset if SQL Server product key is included on installation media.

 

-SqlInstanceName

Target SQL Server instance name. Can be unset if only one instance is installed in the specified virtual machine.

 

-IAcceptLicenseTerms

Flag to indicate acceptance of Microsoft product license terms.

 

-NoVmSnapshot
By default, prior to upgrade, a virtual machine snapshot is created in vCenter on the VM to be upgraded. If this flag is set, creation of a snapshot is skipped.

 

-Help

Print this help

 

Running the Script

The following common scenarios and example PowerShell scripts demonstrate how to automate the upgrade of your Windows and SQL Server using this script.

 

Syntax

The Windows/SQL Server PowerShell script adheres to the following syntax.

 

PS1 C:\> ./Upgrade-WindowsAndSqlServer.ps1 [[-VSphereHostname] <String>] [[-VSphereCredential] <PSCredential>] [[-VmId] <String>] [[-VmName] <String>] [[-VmGuestOsCredential] <PSCredential>] [[-WindowsSetupExePath] <String>] [[-WindowsProductKey] <String>] [[-SqlSetupExePath] <String>] [[-SqlProductKey] <String>] [[-SqlInstanceName] <String>] [-IAcceptLicenseTerms] [-NoVmSnapshot] [-Help] [<CommonParameters>]

 

Example 1: To upgrade both Windows and SQL Server

Performs an upgrade of SQL Server 2008 R2 SP3 on Windows 2008 R2 to SQL Server 2016 on Windows Server 2012 using SQL Server installation media on drive “D” and Windows Server installation media on drive “E”.

 

 PS C:\>./Upgrade-WindowsAndSqlServer.ps1   

    -VSphereHostname vcenter.sddc-XX-XX-XXX-XXX.vmwarevmc.com `

     -VSphereCredential (Get-Credential -UserName 'cloudadmin@vmc.local') `

     -VmName 'keshava-win2008r2-sql2008r2sp3' `

     -VmGuestOsCredential (Get-Credential -UserName 'Administrator') `

     -WindowsSetupExePath 'E:\' `

     -WindowsProductKey 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX' `

     -SqlSetupExePath 'D:\' `

     -IAcceptLicenseTerms

 

Example 2: To upgrade SQL Server

Performs an upgrade of SQL Server 2008 R2 SP3 on Windows Server 2016 to SQL Server 2016 using SQL Server installation media on drive “D”.

 

PS C:\>./Upgrade-WindowsAndSqlServer.ps1 `

    -VSphereHostname vcenter.sddc-XX-XX-XXX-XXX.vmwarevmc.com `

     -VSphereCredential (Get-Credential -UserName 'cloudadmin@vmc.local') `

     -VmName 'keshava-win2008-sql2008' `

     -VmGuestOsCredential (Get-Credential -UserName 'Administrator') `

     -SqlSetupExePath 'D:\' `

     -IAcceptLicenseTerms