Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. ## Set a SMO Server object to the default instance on the local computer.
  2. CD SQLSERVER:SQLlocalhostDEFAULT
  3. $srv = get-item .
  4.  
  5. ## Specify the database to extract to a DAC.
  6. $dbname = "MyDB"
  7.  
  8. ## Specify the DAC metadata.
  9. $applicationname = "MyApplication"
  10. $version = "1.0.0.0"
  11. $description = "This DAC defines the database used by my application."
  12.  
  13. ## Specify the location and name for the extracted DAC package.
  14. $dacpacPath = "C:MyDACsMyApplication.dacpac"
  15.  
  16. ## Extract the DAC.
  17. $extractionunit = New-Object Microsoft.SqlServer.Management.Dac.DacExtractionUnit($srv, $dbname, $applicationname, $version)
  18. $extractionunit.Description = $description
  19. $extractionunit.Extract($dacpacPath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement