From b395fe5708faaf8609167699e62c16a14d7c0a2c Mon Sep 17 00:00:00 2001 From: Hubert Cornet Date: Tue, 18 Jun 2024 09:09:40 +0200 Subject: [PATCH] Ajouter Active Directory/DNS/List-All-Ressources.ps1 --- Active Directory/DNS/List-All-Ressources.ps1 | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Active Directory/DNS/List-All-Ressources.ps1 diff --git a/Active Directory/DNS/List-All-Ressources.ps1 b/Active Directory/DNS/List-All-Ressources.ps1 new file mode 100644 index 0000000..e1bce09 --- /dev/null +++ b/Active Directory/DNS/List-All-Ressources.ps1 @@ -0,0 +1,48 @@ +$DNSServer = "10.78.56.8" + +$Zones = @(Get-DnsServerZone -ComputerName $DNSServer) +$Data = @() +ForEach ($Zone in $Zones) { + ($Zone | Get-DnsServerResourceRecord -ComputerName $DNSServer) | ` + Select-Object -Property ` + @{Label="Zone Name";expression={( $Zone.ZoneName )}},` + DistinguishedName,` + HostName,` + RecordClass,` + RecordType,` + Timestamp,` + TimeToLive,` + @{label="Data";expression={ + $r = $_.RecordData + switch ($_.RecordType) + { + "A" { $r.IPv4Address.IPAddressToString } + "NS" { $r.NameServer } + "SOA" { + "ExpireLimit=$($r.ExpireLimit);"+ + "MinimumTimeToLive=$($r.MinimumTimeToLive);"+ + "PrimaryServer=$($r.PrimaryServer);"+ + "RefreshInterval=$($r.RefreshInterval);"+ + "ResponsiblePerson=$($r.ResponsiblePerson);"+ + "RetryDelay=$($r.RetryDelay);"+ + "SerialNumber=$($r.SerialNumber)" + + } + "CNAME" { $r.HostNameAlias } + "SRV"{ + "DomainName=$($r.DomainName);"+ + "Port=$($r.Port);"+ + "Priority=$($r.Priority);"+ + "Weight=$($r.Weight)" + } + "AAAA" { $r.IPv6Address.IPAddressToString } + "PTR" { $r.PtrDomainName } + "MX" { + "MailExchange=$($r.MailExchange);"+ + "Prefreence=$($r.Preference)" + } + "TXT" { $r.DescriptiveText } + Default { "Unsupported Record Type" } + }} + } +} \ No newline at end of file