Skip to content

Export-DbaDacPackage - How to exclude multiple object types #8650

Answered by supertoad007
supertoad007 asked this question in Q&A
Discussion options

You must be logged in to vote

Answering my own question, but it may help someone else who wants to do the same thing.

I have found one way to do it.

By using New-DbaDacProfile with -PublishOptions and then publishing the dacpac via Publish-DbaDacPackage

Here's the relevant snippet of the code I've done...

$DacPacFileName = New-DbaDacProfile -SqlInstance $SQLSource -Database $Database -Path $DacPacPath -WarningAction Stop
-PublishOptions @{ExcludeLogins=$true;ExcludeUsers=$true;IgnoreRoleMembership=$true;} | SELECT -ExpandProperty FileName

Export-DbaDacPackage -SqlInstance $SQLSource -Database $Database | Publish-DbaDacPackage -PublishXml $DacPacFileName -Database $Database -SqlInstance $SQLDestination

Thanks

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@potatoqualitee
Comment options

Answer selected by supertoad007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants