Database Snapshots In dbatools
Chrissy LeMaire shows how easy it is to create and manage database snapshots with dbatools:
To create a new snapshot, you no longer need to know the path of the snapshot location (though we do support custom paths). You don’t even need to specify a name! But you can, of course.
# Here’s how you create a snapshot for the HR and Accounting databases on server “sql2017”
New-DbaDbSnapshot -SqlInstance sql2017 -Database HR, Accounting
# Want it to be created in a specific path?
New-DbaDbSnapshot -SqlInstance sql2017 -Database HR, Accounting -Path S:\snaps
# Want to create snapshots on a bunch of different servers?
# You can pass -SqlInstance $servers or you can pipe from Out-GridView in PS v5.1 and below!
$servers | Get-DbaDatabase | Out-GridView -PassThru | New-DbaDbSnapshot
I haven’t used database snapshots in a while, but I do appreciate them, especially for testing scenarios.