Solved

Require a PowerShell script to delete host and reverse lookup records in DNS of computers in a specific OU.

Posted on 2013-10-23
1
2,517 Views
Last Modified: 2013-12-09
Folks -

I would like assistance in crafting a PowerShell script (using only built-in cmdlets or command line apps, no 3rd party utils such a Quest) that will delete the DNS entries in the Forward and Reverse DNS zones for any computer accounts that are in a given OU.

So... let us say an OU is named "DisabledComputers".  I'd like the script to run through the forward and reverse zones in "Domain.lcl" and remove any DNS records for the computers in that OU.

In other words, if a computer "WorkstationA" is in the OU named "DisabledComputers", I'd like the Host and PTR records for that computer removed from the "Domain.lcl" DNS zones.  The script is essentially cleaning up DNS entries in real time as computers are expired from my domain for inactivity.

Yes, I use scavenging on a daily interval with default refresh/no-refresh periods.  However, in this case, there are valid reasons why I don't want to wait for record expiration and scavenging.

Thanks in advance for your help.
0
Comment
Question by:amendala
1 Comment
 
LVL 53

Accepted Solution

by:
Will Szymkowski earned 500 total points
ID: 39594992
There are no native Powershell cmdlets to accomplish what you are doing for server 2008. If you are using Server 2012 you can do this natively.

For server 2008 there has been a script to accomplish this using dnscmd to modify DNS records.

PS Script Download - http://gallery.technet.microsoft.com/scriptcenter/Update-DNS-records-with-da10910d

You will need to add your list of computers to the script via CSV file.

You can use the below script to get a list of computers from the DisabledComputers OU and then export them to a csv file. From there you put the file path into the PS script found at the download link...

Get-ADComputer -Filter * -SearchBase "OU=DisabledComputers,DC=domain,DC=com" | select DNSHostName | Export-csv "c:\computers.csv"

Will.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question