Skip to content

Setup Instructions

GWalkey edited this page Dec 9, 2020 · 42 revisions

Dependencies

If you want to run the script:

  • 21_Dac_Packages.ps1

You need to download the latest SMO and DacFX DLLs form NuGet and place them in a folder that the powershell script can find (Preferrably an "\assemblies" folder beneath whatever folder you downloaded and run these from. AKA C:\dbscripts\assemblies.

You will have to edit 21_Dac_Packages to point the Add-Type commands to point to your downloaded versions.

Edit 21_Dac_Packages.ps1

$dacdll = "C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.150.4897.1\lib\net46\Microsoft.SqlServer.Dac.dll"
if((test-path -path $dacdll))
{
    $dacver = 150
    add-type -path "C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.150.4897.1\lib\net46\Microsoft.SqlServer.TransactSql.ScriptDom.dll"
    add-type -path "C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.150.4897.1\lib\net46\Microsoft.Data.Tools.Schema.Sql.dll"
    add-type -path "C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.150.4897.1\lib\net46\Microsoft.SqlServer.Types.dll"
    add-type -path "C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.150.4897.1\lib\net46\Microsoft.SqlServer.Dac.dll"
}

SMO and DacFX
Run the Powershell script [Install-NuGet_Dependencies.ps1] in a elevated Powershell Console

OR
Manual install
First, you need to Setup the NuGet Package Provider

  1. Nuget
    In an Elevated Powershell session, type:
Register-PackageSource -Name Nuget -Location "http:https://www.nuget.org/api/v2" –ProviderName Nuget -Trusted
  1. Install DacFx DLLs
    In an Elevated Powershell session, type:
Install-Package Microsoft.SqlServer.DacFx.x64 -Source 'NuGet'
  1. Install SMO Dlls
    In an Elevated Powershell session, type:
Install-Package Microsoft.SqlServer.SqlManagementObjects -skipdependencies  -Source 'NuGet'
  1. Load and Verify the installed DLL Versions exist and can be loaded Powershell:
Add-Type -Path 'C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.SqlManagementObjects.160.2004021.0\lib\net462\Microsoft.SqlServer.Smo.dll'
Add-Type -Path 'C:\Program Files\PackageManagement\NuGet\Packages\Microsoft.SqlServer.DacFx.x86.150.4573.2\lib\net46\Microsoft.SqlServer.Dac.dll'

List Latest Nuget Package Versions:

Find-Package -Name "Microsoft.SqlServer.SqlManagementObjects" -Source "https://www.nuget.org/api/v2"
Find-Package -Name "Microsoft.SqlServer.DacFx.x64" -Source "https://www.nuget.org/api/v2"

List your installed Package Versions:

get-package | where-object {$_.name -match 'SqlManagementObjects'} |sort version
get-package | where-object {$_.name -match 'DacFx'} |sort version

Analysis Services AMO
https://docs.microsoft.com/en-us/azure/analysis-services/analysis-services-data-providers

Active Directory:
If you want to resolve AD Group Members, you will need the RSAT (AD) Powershell Module.

RSAT for Windows 7
https://www.microsoft.com/en-us/download/details.aspx?id=7887

RSAT for Windows 8.0
https://www.microsoft.com/en-us/download/details.aspx?id=28972

RSAT for Windows 8.1
https://www.microsoft.com/en-us/download/details.aspx?id=39296

RSAT for Windows 10
Installing Windows 10 RSAT is more complicated:
There is a separate download for each Windows 10 Build
After the October 2018 Build, RSAT became a "Feature On Demand"
Also, you will need to reinstall RSAT after a major Windows 10 Build upgrade!

Clone this wiki locally