Splatting in PowerShell makes code easier to read. Instead of typing a bunch of parameters allllll across the screen, you can use an easy-to-read hashtable or array. Argument splatting was introduced in PowerShell v3 and works with all PowerShell commands, not just dbatools.
Note: I’ve only used splatting with hashtables, as they allow me to be explicit about which parameters I’m passing. It appears that arrays would employ positional parameters, which is less wordy but leaves room for error.
Data compression is not a new feature in SQL Server. In fact it has been around since SQL Server 2008, so why does it matter now? Before SQL Server 2016 SP1 this feature was only available in Enterprise edition. Now that it’s in Standard edition data compression can be an option for far more people.
dbatools has three functions available to help you work with data compression, and in true dbatools style it makes it easy and fast to compress your databases.
We recently released a VS Code extension that lets you highlight terms and search dbatools.io, Microsoft Docs, Google, StackOverflow, DuckDuckGo, Technet or Thwack right from your code! It’s called search from code and you can find it in the Extension Marketplace.
Options and Settings By default, only Google, docs and dbatools are enabled but you can configure whichever providers you’d like in VS Code Settings.
At first, I was just messing around to see what it took to create a VS Code extension, but then I realized that I was actually using it and decided to share.
We’ve made even more progress in the past week! Here are some highlights of 0.9.520.
Non-Breaking Changes Aliases have been added for the changes, so these are not breaking changes:
Mismatched Copy commands have been renamed to match their corresponding Get command names (ie. Copy-DbaCentralManagementServer is now Copy-DbaCmsRegServer). Most parameters named Password have been changed to SecurePassword. They’ve always been a SecureString data type but this makes that clear. The parameters ExcludeAllSystemDb and ExcludeAllUserDb have been changed to ExcludeSystem and ExcludeUser, respectively.
Before I go into the breaking changes introduced in 0.9.518, I wanted to highlight Invoke-dbatoolsRenameHelper which is an awesome command that will help you with a vast majority of our renames. Using it is as simple as:
Get-ChildItem *.ps1 -Recurse | Invoke-dbatoolsRenameHelper
This command even takes care of a couple parameter renames like NetworkShare and UseLastBackups.
Breaking Changes It’s been a busy couple days! Here’s a list of our breaking changes
Thanks to several of our team members, we’re now progressing quickly towards dbatools 1.0! 🙌
The progress is so encouraging, I believe 1.0 is around the corner. Because of this, I wanted to let you all know that tomorrow, we’ll start introducing breaking changes.
Output Changes Things like output and parameter names will change. For example, the output for the command Get-DbaPrivilege will be updated. Currently, it looks like this:
During the month of October 2018 DigitalOcean is again running Hacktoberfest to support open source projects. They are offering a limited edition T-Shirt for any person making five pull requests to any public repo on GitHub.
To get a shirt, you must make five pull requests (PRs) between October 1-31 in any timezone. PRs can be to any public repo on GitHub, not just the ones highlighted. The PR must contain commits you made yourself.
Just a quick note that we’ve made more changes to align with 1.0, now available in version 0.9.453.
Renamed Log Shipping Get-DbaDbLogShipError Invoke-DbaDbLogShipping Invoke-DbaDbLogShipRecovery Test-DbaDbLogShipStatus
Registered Servers (Central Management Server) Add-DbaRegServer Add-DbaRegServerGroup Get-DbaRegServer Get-DbaRegServerGroup Get-DbaRegServerStore Import-DbaRegServer Move-DbaRegServer Move-DbaRegServerGroup Remove-DbaRegServer Remove-DbaRegServerGroup
And don’t forget, you can use Invoke-DbatoolsRenameHelper to rename commands in your scripts.
Get-ChildItem .\scripts | Invoke-DbatoolsRenameHelper New I’ll write about these more soon, but until then, enjoy this piping hot batch of new HA commands.
Now that you’ve convinced your security team that PowerShell improves your security posture, it’s time to learn PowerShell if you haven’t already.
Month of Lunches Learn PowerShell in a Month of Lunches Hands down, the one book most people recommend for learning PowerShell is Learn Windows PowerShell in a Month of Lunches by Don Jones and Jeffrey Hicks. You can buy the 3rd edition from Amazon or directly from Manning.
Last year, during our PASS Summit and SQL Bits precons, we highlighted the reasons that PowerShell is even more secure than GUI administration.
I even created a cute lil logo for it 😊
Recently, our team had a discussion about security in #dbatools-dev and I realized I should probably highlight why PowerShell and dbatools are ideal for every organization, including security-minded organizations.
If you’re questioned about PowerShell or dbatools, here are some handy facts to help prove we can help make your administration more, not less, secure.
A while back, I added some new features to our migration commands but I forgot to blog about them. Then, I used one of the new features for a fast and successful migration, got so pumped and had to share.
Multiple Destinations Now, you can migrate from one server to many. This applies to both Start-DbaMigration and all of the Copy-Dba* commands, including Copy-DbaDatabase and Copy-DbaLogin.
As you may be able to see in the title bar of this Out-GridView, I am migrating from workstation, which is a SQL Server 2008 instance, to localhost\sql2016 and localhost\sql2017.
Over the weekend, I presented a session in Glasgow called doomsday prepping with dbatools at SQLGLA, a community event hosted by Craig Porteous, sql_bob and Louise Paterson.
It was a lot of fun, even though the audience put no effort into winning the MRE give away
Now I’ve got some ready-to-eat beef tacos when the zombie apocalypse hits!
Down to Business When we talk about Disaster Recovery or DR, it’s often coupled with the term High Availability or HA.
We’ve been busy the past few days and have huge updates to share.
New Docs Site First, our new beta docs site is now up at dbatools.io/commands! Please check it out and let us know what you think.
This new docs site is auto-generated by our command help! Auto-generated docs were required because we’re adding so many new commands and updating so often, keeping our website up-to-date was just too time-consuming.
Marching onward to dbatools 1.0, a ton of commands have been renamed to align with our now mature naming scheme. These changes were made in today’s release, version 0.9.410 aka regularlegs, now available on GitHub and the PowerShell Gallery.
Here’s the general idea:
DbaDatabase has mostly been renamed to DbaDb with a couple exceptions DbaSql has been changed to just Dba, no exceptions. Considering Microsoft reserved the Sql prefix and we can’t use it, think of Dba as “Sql”.
Last night’s #PSPowerHour made me realize I should highlight a few awesome projects I’ve come across recently.
PSDatabaseClone PSDatabaseClone was created by Sander Stad.
PSDatabaseClone is a PowerShell module for creating SQL Server database images and clones. It enables administrator to supply environments with database copies that are a fraction of the original size.
It is well-documented and open-source.
dbops dbops was created by Kirill Kravtsov.
dbops is a Powershell module that provides Continuous Integration/Continuous Deployment capabilities for SQL database deployments.
Hey all! Kirill Kravtsov, here. I’m a SQL Server DBA that is passionate about automation and PowerShell. I’m also a major contributor to dbatools and creator of the dbops module, which provides continuous database deployments at any scale.
This week, I wrote an article on my blog and Chrissy asked me to mirror it on dbatools, so here we go.
Introduction Many SQL Server DBAs know that there is a very convenient way of delivering a full copy of the database structure to a different SQL Server: it’s called dacpac, or a Data-tier Application package.
Last night was the premiere of #PSPowerHour! It featured great speakers and a lot of dbatools content.
What is PSPowerHour? Created by Michael T Lombardi and Warren F, PSPowerHour is “like a virtual User Group, with a lightning-demo format, and room for non-PowerShell-specific content. Eight community members will give a demo each PowerHour.”
Sessions are proposed and organized on GitHub, which is really cool. Both new and seasoned speakers are invited to propose topics 🙌
Hey all, my name is Marcin and this is my first post and my first contribution to the dbatools. I hope you find it useful.
Introduction Part of a successful administration and management of any database is to know what happens over a period of time, when scheduled jobs and backups run and whether they are successful or not.
The common difficulty is getting this information out of SQL Server and then - the most difficult part - understanding what it means.
When connecting to a SQL Server instance with alternative credentials, it can be tedious to repeat the SQL credential over and over.
The great news is that this repetition is not required, as it can be handled instead by $PSDefaultParameterValues
Intro to $PSDefaultParameterValues $PSDefaultParameterValues is a hashtable available in PowerShell that can set defaults for any command that you run. In it’s simplest form, setting a default parameter value can look like this:
SQL Server’s Central Management Server (CMS), first introduced in SQL Server 2008, “stores a list of instances of SQL Server that is organized into one or more central management server groups”.
It’s a super useful feature that not all DBAs know about. Since CMS data is stored in msdb and accessible via SMO, you can access it from SQL Server Management Studio or PowerShell modules like dbatools.
Central Management Server’s essential functionality includes: