≡ Menu

Force dns registration on remote computers using PowerShell

In this article, let us see force local or remote computer to register its IP address in DNS using PowerShell. The native way of doing it is ipconfig /registerdns. The disadvantage with this is it cannot be used for triggering dns registration on remote computers.

There is a cmdlet called Register-DNSClient in DNSClient module which comes by default with Windows Server 2012/Windows 8 or above operation systems. The good thing with this cmdlet is it can be used for forcing remote clients to register dns.

First let us see how to force the local computer to register its DNS records.

Register-DnsClient            

Running above cmdlet from a PowerShell prompt will initiate the registration process.

If you want to perform similar operation against a remote computer, then you can use CimSession to trigger this.

$Computername = "TIBDC01"            
([WMIClass]"\\$ComputerName\ROOT\CImv2:Win32_Process").Create("cmd.exe /c ipconfig /registerdns")

This procedure works for Windows Server 2012/Windows 8 or later operating system. However if your remote computer is lower version than aforementioned versions, then you can use Get-WMIObject cmdlet to trigger this remotely.

This WMI approach works for any of the windows operating systems.

$session = New-CimSession -ComputerName TIBDC01            
Register-DnsClient -CimSession $session            

This way you can force the registration of DNS on any remote windows computer using PowerShell.

Comments on this entry are closed.

  • paul December 7, 2020, 3:41 am

    Catch22 there – problem is that if the remote device isn’t registered in DNS, the name in the first line can’t be resolved, so it doesn’t work….

    • Fitzy July 15, 2021, 8:59 am

      So IP address is the only option. ?

      • Wintel Rocks July 16, 2021, 5:53 am

        Fitzy, yes. If the hostname is resolving you can use the IP address.