Copy-SqlDatabaseAssembly not working with Unrestricted security level nor with different Database Owner #659

mvillegascuellar opened this Issue Feb 6, 2017 · 0 comments


None yet

2 participants


Is this a feature OR bug:


System Details

  • Operating system name and version: Windows 10 Enterprise
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.14393.693
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14393.693
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
  • Output of dbatools version:
Major  Minor  Build  Revision
-----  -----  -----  --------
0      8      694    -1
0      8      5      56
  • SQL Server version for source/target

Source: SQL Server 2014
Target: SQL Server 2016

Steps to Reproduce

On source SQL Server I have a database with an assembly with "Unrestricted" security level and "sa" as database owner. On target SQL Server I have a database with owner as "user1" and not trustworthy. I tried to copy the assembly with the following command:

Copy-SqlDatabaseAssembly -Source mvillegas -Destination "mvillegas\sql2016" -Assemblies PLS_PRD.PcMilerCLR

I tried to fix the errors manually by setting the same owner and puting the database as trustworthy and it worked as expected

Action Results

WARNING: See error log C:\Users\michael.villegas\Documents\dbatools-exceptions.txt for more details.

Expected Results

Copy the assembly successfully

Attached Logs or any exception errors


@SirCaptainMitch SirCaptainMitch added the bug label Feb 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment