commands

^

Install-DbaSqlPackage

Author Chrissy LeMaire and Claude
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Install-DbaSqlPackage on GitHub.
Want to see the Bill Of Health for this command? Check out Install-DbaSqlPackage.

Synopsis

Downloads and installs SqlPackage on Windows, Linux, or macOS

Description

Downloads and installs SqlPackage so that you can use Import-DbaDacpac, Export-DbaDacpac, Publish-DbaDacpac and Get-DbaDacpac.

Cross-platform support:

  • Windows: Supports both ZIP (portable) and MSI installation methods
  • Linux/macOS: Supports ZIP installation method only

By default, SqlPackage is installed as a portable ZIP file to the dbatools directory for CurrentUser scope.
For AllUsers (LocalMachine) scope on Windows, you can use the MSI installer which requires administrative privileges.

Writes to $script:PSModuleRoot\bin\sqlpackage by default for CurrentUser scope.

Syntax

Install-DbaSqlPackage
    [[-Path] <String>]
    [[-Scope] <String>]
    [[-Type] <String>]
    [[-LocalFile] <String>]
    [-Force]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Install-DbaSqlPackage

Downloads SqlPackage ZIP to the dbatools directory for the current user

Example: 2
PS C:\> Install-DbaSqlPackage -Scope AllUsers -Type Msi

Downloads and installs SqlPackage MSI for all users (requires administrative privileges)

Example: 3
PS C:\> Install-DbaSqlPackage -Path C:\SqlPackage

Downloads SqlPackage ZIP to C:\SqlPackage

Example: 4
PS C:\> Install-DbaSqlPackage -LocalFile C:\temp\sqlpackage.zip

Installs SqlPackage from the local ZIP file.

Optional Parameters

-Path

Specifies the path where SqlPackage will be extracted or installed.
If not specified, SqlPackage will be installed to the dbatools directory for CurrentUser scope.

Alias
Required False
Pipeline false
Default Value
-Scope

Specifies the installation scope. Valid values are:

  • CurrentUser: Installs to the dbatools directory (default, uses ZIP)
  • AllUsers: Installs to system location (Windows: Program Files with MSI/admin privileges; Unix: /usr/local/sqlpackage)
Alias
Required False
Pipeline false
Default Value CurrentUser
Accepted Values CurrentUser,AllUsers
-Type

Specifies the installation type. Valid values are:

  • Zip: Downloads and extracts the portable ZIP file (default, works on all platforms)
  • Msi: Downloads and installs the MSI package (Windows only, AllUsers scope only, requires admin privileges)
Alias
Required False
Pipeline false
Default Value Zip
Accepted Values Zip,Msi
-LocalFile

Specifies the path to a local file to install SqlPackage from. This file should be an msi or zip file.

Alias
Required False
Pipeline false
Default Value
-Force

If this switch is enabled, the Sqlpackage will be downloaded from the internet even if previously cached.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value