Skip to content

Instantly share code, notes, and snippets.

View KianNH's full-sized avatar

Kian KianNH

View GitHub Profile
@KianNH
KianNH / cloudflare-remove-all-records.ps1
Created May 13, 2022 15:55
Cloudflare - Remove all DNS records in a given zone
$API_TOKEN = "<api-token>"
$ZONE_ID = "<zone-id>"
$baseUrl = "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records"
$headers = @{
'Authorization' = "Bearer $API_TOKEN"
'Content-Type' = "application/json"
}
@KianNH
KianNH / foo.ps1
Last active November 25, 2021 17:31
# get all of the groups under a provided organizational unit (recursive)
$groups = Get-ADGroup -Filter * -SearchBase '<distinguishedName>' -Properties Description
# loop through all the groups we just got
foreach ($group in $groups) {
# get the members of the group, and loop through those members
Get-ADGroupMember -Identity $group | foreach {
# create a pscustomobject to store our data
[pscustomobject]@{
groupname = $group.Name