Change owner dns record using powershell

Mohamed SAKHO 96 Reputation points


I would like to change many owner dns record in order to replace it by their object name computer using powershell.
Please does someone can help me, or have any script which can do this?
Or allow full control the computer name object for their each dns record via powershell.
Thank you by advance.

Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
8,872 questions
Windows DHCP
Windows DHCP
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.DHCP: Dynamic Host Configuration Protocol (DHCP). A communications protocol that lets network administrators manage centrally and automate the assignment of Internet Protocol (IP) addresses in an organization's network.
942 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,757 questions
No comments
{count} votes

2 additional answers

Sort by: Most helpful
  1. Rich Matheisen 36,331 Reputation points

    Are you trying to fix inconsistent permissions so dynamic DNS updates are allowed to be made by the computer account?

    Here's one: Resolve-DdnsRecordPermissionProblem.ps1

  2. Limitless Technology 37,611 Reputation points


    additional clarifying question would be if you are trying to remove from the DNS lists some current computer owner so you see the sid info as the current owner? And you like to replace it to computer_name.

    Import-Module D:\Powershell\DNS\DnsShell
    Import-Module ActiveDirectory
    Add-PSSnapin Quest.ActiveRoles.ADManagement

    Retrieve records

    $servers = get-content D:\Powershell\Scripts\DNSRECORDS.txt
    $newarray = @()
    foreach ($computer in $servers) {
    Get-ADDnsPartition | Get-ADDnsRecord | Where-Object {$.Name -eq $Computer} | % {
    $RecordName = $
    $RecordName = "GTLAW\$RecordName" + '$'
    $RecordDN = (Get-ADObject –Identity $.ObjectGUID).DistinguishedName
    $Owner = (Get-Acl -Path "ActiveDirectory:://RootDSE/$RecordDN").Owner
    If ($Owner -eq "$RecordName") {
    Write-Host 'Good |' $
    .Name '|' $Owner
    } Else {
    Write-Host 'Bad |' $.Name '|' $RecordName $Owner
    $AdACL = get-ACL ("AD:\" + $RecordDN)
    $ADobject = New-Object System.Security.Principal.NTAccount($
    .NAME + "$")
    $sid = $ADobject.Translate([System.Security.Principal.SecurityIdentifier])
    set-acl -path ("AD:\" + $RecordDN) -AclObject $AdACL

    If the reply is helpful, please Upvote and Accept as answer