SQL Change Automation 4

Installing and Updating PowerShell components

SQL Change Automation PowerShell components may be installed and upgraded in two ways

  1. From the PowerShell Gallery
  2. By the SQL Toolbelt Installer

A key thing to understand is that the way SQL Change Automation PowerShell components are installed is the way you will upgrade them

For example, if you installed the PowerShell components from the SQL Toolbelt installer and you attempt to upgrade them from the PowerShell Gallery, you will see an error message:

Module 'SqlChangeAutomation' was not installed by using Install-Module, so it cannot be updated.

If you wish to change the way you update SQL Change Automation PowerShell components from one of these methods to the other, you may do so at any time

  • Open "Add or Remove Programs" in System Settings (or Run: appwiz.cpl)
  • Search for "SQL Change Automation PowerShell" in the list
  • Uninstall the program
  • Reinstall the program using the desired methodology from the list below

Please note that this does NOT require uninstalling the entire SQL Toolbelt, only the "SQL Change Automation PowerShell" program.

Method 1: Installing and Upgrading from PowerShell Gallery

SQL Change Automation is available from the PowerShell Gallery. You'll need at least version 1.6 of the PowerShellGet module to install the SQL Change Automation module.

Install PowerShellGet 1.6 if necessary

Instructions on how to install PowerShellGet can be found on the Microsoft documentation site. If you're using PowerShell 5 or greater, you can run the following in an elevated PowerShell session:

Install-PackageProvider NuGet -Force

then, in a new elevated PowerShell session, run Install-Module to install the latest PowerShellGet:

Install-Module PowerShellGet -MinimumVersion 1.6 -Force -AllowClobber

It's important that you exit the PowerShell session each time, otherwise the wrong versions of the package management module and/or package provider might be used (see, for example, the issues documented in https://github.com/PowerShell/PowerShellGet/issues/246).

Install the SqlChangeAutomation module

Run the following in an elevated PowerShell session:

Install-Module SqlChangeAutomation

Updating the SqlChangeAutomation module

To update the SqlChangeAutomation module to the latest version available on the gallery, run the following in an elevated PowerShell session:

Update-Module SqlChangeAutomation

Installing or updating as part of an automated build/release script

The instructions above require an elevated PowerShell session, and will prompt you to accept the license for SqlChangeAutomation before installing it. If you're installing and/or updating as part of an automated process, you can install the module in the current user scope, and accept the license as part of the installation. To do this, run the following scripts instead:

Install-Module SqlChangeAutomation -Scope CurrentUser -AcceptLicense
Update-Module SqlChangeAutomation -AcceptLicense

By adding the -AcceptLicense argument, you are confirming that you accept the license agreement for SqlChangeAutomation as detailed in the Redgate standard EULA. If you do not wish to be bound by that license, do not install the SqlChangeAutomation module.

For more information see the documentation on Install-Module and Update-Module

Method 2: Installing and Upgrading from SQL Toolbelt

If you cannot use PowerShellGet, or if you prefer to manage your SQL Change Automation PowerShell cmdlets with the rest of your Redgate implementation, you can install and upgrade using the SQL Toolbelt installer.

To install and upgrade the SQL Change Automation PowerShell components, you may either:

  1. Run the full SQL Toolbelt installer
  2. Check for updates on the standalone installer for SQL Change Automation PowerShell: https://download.red-gate.com/checkforupdates/SCAPowerShell/ 

Note: If you initiate and upgrade of the SQL Change Automation plugin(s) from SQL Server Management Studio or Visual Studio, that upgrade does not upgrade the SQL Change Automation PowerShell components, as these are managed as two separate programs.

To run an unattended installation of the SQL Toolbelt

SQLToolbelt.exe /IAgreeToTheEULA

For help getting started with SQL Change Automation PowerShell components after installation

Our online reference for SQL Change Automation PowerShell cmdlets contains full details for each cmdlet as well as usage examples.

Didn't find what you were looking for?