Provides powershell cmdlets for managing and configuring sql server in a repeatable manner, ideal for continuous integration/deployment scenarios.
-
Install nuget package
nuget install shellpower.sqlserver -outputdirectory packages
-
Create new file
getting-started.ps1with the following content# dot source the script . packages\bin\sqlserver.ps1 -dbServer "localhost" -dbName "foo" # Create sql user "bar" and assign it to db "foo" Add-DbUser -name "bar" -password "test-passw0rd!" # Remove sql user "bar" from db "foo" and from sql logins Remove-DbUser "bar"
-
Run
.\getting-started.ps1
Refer to the tests in the source code for more examples.