Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Thursday, October 27, 2011

Delete a DNS zone with PowerShell

When it comes time to remove a zone from a DNS server, you can accomplish this task with PowerShell

 

We are going to remove a zone called Test.Contoso.com.

 

Log into your DNS server with an account that has the permissions to delete the zone.

 

Open PowerShell and type the following command.

 

Get-WMIObject –NameSpace “Root\MicrosoftDNS” –Class MicrosoftDNS_Zone | Where-Object {$_.Name –eq “Test.Contoso.Com”} | Remove-WMIObject

 

You may need to close and then reopen the DNS console to see the zone completely removed.

No comments: