Skip to content

Instantly share code, notes, and snippets.

@HarmJ0y
Last active August 31, 2022 17:21
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save HarmJ0y/f556a478f42139010f6081d99c9e5595 to your computer and use it in GitHub Desktop.
Save HarmJ0y/f556a478f42139010f6081d99c9e5595 to your computer and use it in GitHub Desktop.
wmi_dns
Get all zones:
Get-WmiObject MicrosoftDNS_Zone -Namespace Root\MicrosoftDNS -ComputerName primary.testlab.local | Select ContainerName
Get all A records from a zone:
Get-WmiObject -Namespace Root\MicrosoftDNS -Query "SELECT * FROM MicrosoftDNS_ResourceRecord WHERE ContainerName='testlab.local'" -ComputerName primary.testlab.local | ?{$_.TextRepresentation -match " A "} | Select -Expand TextRepresentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment