cmdlet : How to remove all clones for a specific machine (agent)
Hello,
in a similar fashion to the "Remove All Clone for an Image", can I remove all clones for a machine? I'm not certain that using Get-SqlClone how to filter all clones for a machine name.
Thank you for your help and best regards to the dev team!
(Remove All Clone for an Image)
https://documentation.red-gate.com/display/CLONE2/Remove+all+clones+for+an+image
in a similar fashion to the "Remove All Clone for an Image", can I remove all clones for a machine? I'm not certain that using Get-SqlClone how to filter all clones for a machine name.
Thank you for your help and best regards to the dev team!
(Remove All Clone for an Image)
https://documentation.red-gate.com/display/CLONE2/Remove+all+clones+for+an+image
Tagged:
Best Answer
-
owen.hall Posts: 57 Silver 4Hi Benethor, how about something like this?
Connect-SqlClone -ServerUrl 'http://sql-clone.example.com:14145' $environmentName = $null # replace with environment name string if desired $machineName = 'myMachineName' $instancesOnMachine = Get-SqlCloneSqlServerInstance -MachineName $machineName | where {$_.Environment -eq $environmentName} foreach ($instance in $instancesOnMachine) { $clonesToDelete = Get-SqlClone -Location $instance foreach ($clone in $clonesToDelete) { Remove-SqlClone $clone | Wait-SqlCloneOperation } }
This will find all SQL Server instances on a named machine, then find all clones based on those instances, and delete them.Software Engineer
Redgate Software
Answers
Thanks a lot!
Edit: updated!
Redgate Software