# Load the DNS Server module
Import-Module DnsServer
# Set the output folder
$outputFolder = "C:\temp\Final"
$DNSServer = DNSServer.com
# Get all DNS zones
$zones = Get-DnsServerZone -ComputerName $DNSServer
# Loop through each zone and export its records to a separate CSV file
foreach ($zone in $zones) {
$records = Get-DnsServerResourceRecord -ZoneName $zone.ZoneName -ComputerName $DNSServer| `
select hostname,`
recordtype,`
type,timestamp,`
timetolive,`
@{n='Data';e={$rr = $_;`
switch ($rr.RecordType) {
'A' {$rr.RecordData.IPv4Address}
'CNAME' {$rr.RecordData.HostnameAlias}
'NS' {$rr.RecordData.NameServer}
'SOA' {$rr.RecordData.PrimaryServer}
'SRV' {$rr.RecordData.DomainName}
'PTR' {$rr.RecordData.PtrDomainName}
'MX' {$rr.RecordData.MailExchange}
'AAAA' {$rr.RecordData.IPv6Address}
'TXT' {$rr.RecordData.DescriptiveText}
}}}
$outputFile = "$outputFolder\$($zone.ZoneName).csv"
$records | Export-Csv -NoTypeInformation -path $outputFile
}
# Output confirmation message
Write-Host "DNS records exported to $outputFolder."
These are just random notes and programs that may have incomplete descriptions. Any scripts or programs use at your risk
Showing posts with label DNS. Show all posts
Showing posts with label DNS. Show all posts
Friday, March 17, 2023
Subscribe to:
Posts (Atom)
Powershell: Microsoft Graph to add new roles to application registration
PowerShell Script Bulk add new roles to application registration in azure. Update $roles with ,Us...
-
Here is an excel document I created that will ping a list of nodes in column A and give results in column B. There are much better tools th...
-
#reads event logs for filter and exports to $Date = ( Get-Date ).AddMinutes(-30) $LogName = 'Security' $ProviderName = ...
-
Using Google Chrome or MS Edge: Disable Javascript post page load. 1. Open console in dev tools 2. press ctrl - alt - p 3. In the run dial...