V
V
Vadim Choporov2017-06-02 14:00:26
PowerShell
Vadim Choporov, 2017-06-02 14:00:26

How to remove NS records from a zone using PowerShell?

Good afternoon.
There are 4 domain controllers. In a test isolated environment, I restore 1 of the controllers, followed by the capture of FSMO roles, cleaning DNS records and working fully alone. There was a problem editing the _msdcs.my.domain.com delegation zone (must remove all NS records except for the controller being restored). From the snap, I can go to the properties of the _msdcs folder in the my.domain.com domain, and delete everything that is needed. But here's how to carry out this operation using powerShell - I'll never know. So far I have found only the option with deleting via cmd - but it says that all suxes, but does not delete records:
.\dnscmd.exe /recorddelete _msdcs.my.domain.com '@' NS /f
.\dnscmd.exe /recorddelete my .domain.com '@' NS /f
Can anyone tell me how to remove them using PS?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Choporov, 2017-06-05
@tolstyiii

Get-DnsServerResourceRecord -ZoneName my.domain.com -RRType Ns | Where {($_.HostName -eq '@') -or ($_.HostName -eq '_msdcs')} | Remove-DnsServerResourceRecord -ZoneName my.domain.com -Force

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question