none
Modifying the DNS CNAME thru Powershell on the remote server RRS feed

  • Question

  • Hi,

    I am looking for a simpler way to update the DNS CNAME by using PowerShell script. We are planning to use this scenario for changing the connection string in the powerBI report server. By changing the CNAME we can point to other server.

    I also need to understand what are the prerequisite to achieve it. I already have the full control for the that CNAME Record. DO we need some other permission. I think we require permission to the DNS server or there is any other way to access the DNS. I am asking this because it is a highly protected environment. 

    Regards
    Rajaniesh 

    • Moved by Bill_Stewart Wednesday, September 5, 2018 10:07 PM This is not "scripts on demand"
    Tuesday, June 19, 2018 1:20 PM

All replies

  • Hi,

    You have to delete the cname first and then recreate it.

    $zone = "mydomain.com"
    $name = "myhost"
    $cname ="mycname"
    $DNSServer = "mydnsserver.mydomain.com"
    
    Remove-DnsServerResourceRecord -Name $name -ZoneName $zone -RRType CName -ComputerName $DNSServer -Force
    Add-DnsServerResourceRecordCName -Name $name -ZoneName $zone -HostNameAlias $cname -ComputerName $DNSServer

    You would need permissions to create the record as well. Once you've created its, you're the owner of it and can delete its again.

    Tuesday, June 19, 2018 2:11 PM
  • This script throws the error. What are the required permission in order for this script to execute.?
    Friday, July 6, 2018 8:42 PM
  • Admin on the DNS server.


    \_(ツ)_/

    Friday, July 6, 2018 9:02 PM