DNS Audit about newly created records

 

DNS Audit about newly created records

$ComputerName = 'pugazh'

$Zones = Get-DnsServerZone -ComputerName $ComputerName | Where-Object { $_.IsDsintegrated } #get all zones I care about

$DNSRecords = $Zones | Get-DnsServerResourceRecord -ComputerName $ComputerName #get every DNS record

        

$RecordAndOwner = $DNSRecords | ForEach-Object {

    [pscustomobject]@{

        Record = $_

        Owner  = (Get-Acl $('AD:\' + $_.DistinguishedName)).Owner

    }

}

        

$RecordAndOwner #List all the owners... wait, that is too much stuff and too hard to read

        

#List everyone that has created a DNS record and how many records they have created (only checks owner, but owner is the creator by default)

$RecordAndOwner | Group-Object owner | Select-Object count, name | Sort-Object name

        

#Omit records created by servers

$RecordAndOwner | Group-Object owner | Where-Object { $_.Name -notlike '*$' } | Select-Object count, name | Sort-Object name

        

#Investigate which records BillG has created 

($RecordAndOwner | Where-Object { $_.owner -eq 'resources\name' }).Record 

Comments

Popular posts from this blog

Service Principal Names (SPNs) SetSPN Syntax (Setspn.exe)

altiris software key

Group Policy: Troubleshooting Overview