DNS : Command Lines

Bunch of differents command lines relative to DNS I’m oftently using

Export Logs of a Windows DNS Server in a CSV file
Get-WinEvent -ComputerName YourDNSServer_FQDN -LogName "DNS Server" | Select-Object TimeCreated, Id, LevelDisplayName, ProviderName, Message | Export-Csv -Path C:\Temp\DNS-Events.csv -NoTypeInformation
Get DNS Server Conditional forwarders with IP addresses
gwmi -computername YourDNSServer_FQDN -Namespace root\MicrosoftDNS -Class MicrosoftDNS_Zone -Filter "ZoneType = 4" |Select -Property @{n='Name';e={$_.ContainerName}}, @{n='DsIntegrated';e={$_.DsIntegrated}}, @{n='MasterServers';e={([string]::Join(',', $_.MasterServers))}}, @{n='AllowUpdate';e={$_.AllowUpdate}}
Set DNS Servers on a Windows client computer
Get-NetAdapter | fl Name, InterfaceIndex
Set-DnsClientServerAddress -InterfaceIndex "XXX" -ServerAddresses ("1.1.1.1","8.8.8.8,"10.10.10.10")