Skip to content

Instantly share code, notes, and snippets.

@kdrwygvh
Created January 19, 2021 13:39
Show Gist options
  • Save kdrwygvh/2765fe990d0330032db73f74aa96ff05 to your computer and use it in GitHub Desktop.
Save kdrwygvh/2765fe990d0330032db73f74aa96ff05 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# https://social.technet.microsoft.com/wiki/contents/articles/7608.srv-records-registered-by-net-logon.aspx
# https://docs.microsoft.com/en-us/troubleshoot/windows-server/networking/verify-srv-dns-records-have-been-created
declare -a activeDirectoryDomainNameTests=(
_ldap._tcp."$1".
_ldap._tcp.dc._msdcs."$1"
_ldap._tcp.pdc._msdcs."$1".
_kerberos._tcp. "$1" .
_kerberos._udp. "$1" .
_kerberos._tcp.dc._msdcs."$1".
_kpasswd._tcp."$1".
_kpasswd._udp."$1".
)
declare -a activeDirectorySiteNameTests=(
_ldap._tcp. "$2"._sites."$1".
_ldap._tcp. "$2". _sites.dc._msdcs."$1".
_kerberos._tcp."$2"._sites. "$1".
_kerberos.tcp."$2"._sites.dc._msdcs. "$1".
)
declare -a activeDirectoryForestNameTests=(
_ldap._tcp.gc._msdcs."$3".
_ldap._tcp. "$2". _sites.gc._msdcs. "$3".
_gc._tcp."$3".
_gc._tcp."$2"._sites."$3".
)
if [[ "$1" = "" ]]; then
echo "An Active Directory Domain is required"
exit 1
else
for activeDirectoryDomain in "${activeDirectoryDomainNameTests[@]}"; do
dig "${activeDirectoryDomain}" -t SRV
done
fi
if [[ "$2" = "" ]] && [[ "$3" = "" ]]; then
echo "Site Name nor Forest Name were specified, skipping tests"
else
for activeDirectorySiteName in "${activeDirectorySiteNameTests[@]}"; do
dig "${activeDirectorySiteName}" -t SRV
done
for activeDirectoryForestName in "${activeDirectoryForestNameTests[@]}"; do
dig "${activeDirectoryForestName}" -t SRV
done
fi
if [[ "$3" = "" ]]; then
echo "Forest Name was not specified, skipping tests"
else
dig $arrayForestItem -t SRV
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment