How to download and install ApexSQL DevOps toolkit PowerShell cmdlets

Applies to
ApexSQL DevOps toolkit

Summary
This article explains how to download the ApexSQL DevOps cmdlets from GitHub and install them, to integrate into Windows PowerShell.

Description

The ApexSQL DevOps toolkit provides a set of PowerShell cmdlets that can be configured to create a one-click PowerShell script to run your custom SQL Server database CI, CD or custom pipeline. This script can be run either stand-alone, or get integrated into any build server that supports PowerShell/CLI.

Requirements

First, in order to be able to start using the ApexSQL DevOps toolkit, the necessary ApexSQL developer tools that will be involved in each of the CI and CD steps should be installed. Note that not all (or even most) of these tools are required. The number of tools/steps required is based on how extensive a CI/CD workflow pipeline is designed to be.

For a full list of steps and related tools see the ApexSQL DevOps toolkit product page

As of this post, the ApexSQL PowerShell cmdlets are running on PowerShell 5.0, so in order to get started, you will need to make sure that you have this version installed. As new versions of PowerShell are released, we will most likely update our system requirements as well.

If you are unsure of which PowerShell version you have on your system, you can easily determine that by opening Windows PowerShell and running the $PSVersionTable.PSVersion command:

If the Major version is five (5), then you are good to go. Otherwise, you can download PowerShell 5.0 version from here

Quick tip icon

Quick info:

PowerShell 5.0 is installed by default on Windows Server 2016 Technical Preview and Windows 10. Other than that, it can be installed on Windows 7 SP1 or later. Additional details on system requirements and installation instructions can be found here.

Download

Once you have PowerShell 5.0 installed, you can go ahead and download the ApexSQL DevOps toolkit installation module. To do that, follow our product page and by clicking “Download” you will be led to our GitHub repository. There, you can download the One-click-automation-and-Build-server-integration scripts individually or as a zip file.

The downloaded .zip will contain three (3) files:

  • ApexSQL_DevOps.psd1 – This is the module manifest file. It contains general information about this module like the version, author and copyright statements, as well as a list of the available cmdlets
  • ApexSQL_DevOps.psm1 – This is the actual source code file, containing all the PowerShell cmdlets
  • Install.ps1 – This is the installation script that, when run will automatically integrate the cmdlets in Windows PowerShell and create the necessary system folders on your disk

After downloading the scripts.zip file, you can extract the contents to a location of your choice, for example at C:\Users\<current_user>\Desktop\ApexSQL_DevOps

Installation

Once all three installation files are in the same folder, run the Install.ps1 with PowerShell.

If you have never run scripts with PowerShell before, you are going to get the following error:

This is expected, as by default PowerShell does not allow the execution of any saved script files.

To fix this, you can easily change the active PowerShell execution policy (you only need do this once):

  • Run Windows PowerShell as administrator
  • Run the following code: Set-ExecutionPolicy -ExecutionPolicy Unrestricted and when prompted, choose “Yes” to set the new execution policy

Once this is done, you can run the Install.ps1 file. This will integrate the ApexSQL DevOps cmdlets into PowerShell and also create the C:\Program Files\ApexSQL\ApexSQL DevOps toolkit\Modules\ApexSQL_DevOps folder where the ApexSQL_DevOps.psd1 and ApexSQL_DevOps.psm1 will be automatically copied. After that, the initially downloaded files won’t be needed anymore and may be deleted.

When the installation is complete, all ApexSQL Continuous Integration cmdlets will be available in Windows PowerShell and you can start using them to set up your CI or CD PowerShell scripts.

Quick tip icon

Quick tip:

While working with cmdlets, Windows PowerShell ISE is recommended over the standard Windows PowerShell, as it supports the auto-complete feature to suggest available cmdlets and parameters and provides a better insight on the installed cmdlets.

Quick tip icon

Note:

Please check out system requirements for the current version of PowerShell that we support, as it may have changed since the original posting of this article