Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Set a SMO Server object to the default instance on the local computer.
- CD SQLSERVER:SQLlocalhostDEFAULT
- $srv = get-item .
- ## Specify the database to extract to a DAC.
- $dbname = "MyDB"
- ## Specify the DAC metadata.
- $applicationname = "MyApplication"
- $version = "1.0.0.0"
- $description = "This DAC defines the database used by my application."
- ## Specify the location and name for the extracted DAC package.
- $dacpacPath = "C:MyDACsMyApplication.dacpac"
- ## Extract the DAC.
- $extractionunit = New-Object Microsoft.SqlServer.Management.Dac.DacExtractionUnit($srv, $dbname, $applicationname, $version)
- $extractionunit.Description = $description
- $extractionunit.Extract($dacpacPath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement