Getting IP addresses from DNS debugging logs

I am now in process of migrating old AD/DNS integrated servers and promoting new ones. In complex/big environments you can not control everything. That is why before shutting down old ones I turn on DNS debugging to check which clients/servers still use them.

But logs are big and confusing. I turned to Powershell for help to get list of unique IP values. Logs look like this.

To keep things short I need to get IP string from txt file. This is my short script how to do it using regular expression, which is not correct, but work in this case. First thought was to do csv, but I managed to found Select-string  cmdlet

Select-String -Path $inputfile -Pattern "$regex" -AllMatches | % { $_.Matches } | % { $_.Value } |Sort-Object | Get-Unique > $outputfile 

I am waiting for my working buddy to give me peace of code to transfer ip adresses to host name if available. I will update it then. You can contact me if you need explanation. Maybe then I will think more about how this works Smile


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s