Delete All Site Collections From Web Application Except Root Site

Sometimes we come across a situation where we need to delete all site collections except the root site especially when we are migrating my site we might want to remove all existing sites and create my sites again before running migration through tools like share gate etc.

Get-SPSite "http://mysharePoint.com/sites*" -Limit ALL | Remove-SPSite -Confirm:$false

to check if the sites are removed run the below PowerShell script to verify, it should return empty. 

Get-SPSite "http://mysharePoint.com/sites*" -Limit ALL

For my sites above script can be modified as below,

Get-SPSite "http://awesome.com/personal*" -Limit ALL | Remove-SPSite -Confirm:$false
Get-SPSite "http://awesome.com/personal*" -Limit ALL