Skip to content

Instantly share code, notes, and snippets.

@mardahl
Last active October 7, 2021 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/22abcebc77092ee42cc46b45ed1541ac to your computer and use it in GitHub Desktop.
Save mardahl/22abcebc77092ee42cc46b45ed1541ac to your computer and use it in GitHub Desktop.
CloudFlare PowerShell to bulk delete DNS Zones
#license MIT
#Author Michael Mardahl github.com/mardahl
#region declarations
$env:CF_API_KEY = 'axxxxxxxxxxxxxxxxxxxx'
$env:CF_API_EMAIL= 'xxxxxxx@xxxxxx.xxx'
$domains = $(Get-Content .\domains.txt) #text file with 1 domain per line
#endregion declarations
#region execute
foreach ($domain in $domains){
$dom = $domain.ToString()
Write-Verbose "Attempting to remove $dom" -verbose
#you need to download the latest version of flarectl to use with this script
.\flarectl.exe zone delete --zone="$dom"
}
#endregion execute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment