{"id":305,"date":"2014-10-02T15:17:37","date_gmt":"2014-10-02T19:17:37","guid":{"rendered":"http:\/\/adsecurity.org\/?p=305"},"modified":"2014-10-01T21:01:42","modified_gmt":"2014-10-02T01:01:42","slug":"using-powershell-to-perform-a-reverse-dns-lookup-in-active-directory","status":"publish","type":"post","link":"https:\/\/adsecurity.org\/?p=305","title":{"rendered":"Using PowerShell to Perform a Reverse DNS Lookup in Active Directory"},"content":{"rendered":"<p>Typically, one would use ping -a to get the hostname for a specific IP address which performs a DNS reverse lookup.<br \/>\nQuerying AD for a computer with an IP works great for computers joined to the Active Directory domain since most computers in AD have the IP Address configured on the computer account. When the computer is joined to the domain, there are several attributes populated which are updated periodically, such as ipv4address, operatingsystem, operatingsystemversion, servicepack, etc.<\/p>\n<p><span style=\"text-decoration: underline;\">Perform a IP Lookup Using PowerShell to find the associated computer (AD cmdlets):<em><br \/>\n<\/em><\/span><em>import-module activedirectory<\/em><br \/>\n<em>$ComputerIPAddress = &#8216;10.10.10.10&#8217;<\/em><br \/>\n<em>Get-ADComputer -property * -filter { ipv4address -eq $ComputerIPAddress }<\/em><\/p>\n<p><span style=\"text-decoration: underline;\"><br \/>\nPerform a DNS Reverse Lookup (IP to hostname) Using PowerShell (.Net):<\/span><br \/>\n<em>$ComputerIPAddress = &#8216;10.10.10.10&#8217;<\/em><br \/>\n<em>[System.Net.Dns]::GetHostEntry($ComputerIPAddress).HostName<\/p>\n<p><\/em><\/p>\n<p><span style=\"text-decoration: underline;\">Get IP from Hostname Using PowerShell (.Net):<\/span><br \/>\n<em>$ComputerName= &#8216;MetcorpDC01&#8217;<\/em><br \/>\n<em>[System.Net.Dns]::GetHostAddresses(&#8220;$ComputerName&#8221;).IPAddressToString<\/em><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Typically, one would use ping -a to get the hostname for a specific IP address which performs a DNS reverse lookup. Querying AD for a computer with an IP works great for computers joined to the Active Directory domain since most computers in AD have the IP Address configured on the computer account. When the &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/adsecurity.org\/?p=305\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7,2],"tags":[125,124,575],"class_list":["post-305","post","type-post","status-publish","format-standard","hentry","category-microsoft-security","category-powershell","category-technical-reference","tag-dnsreverselookup","tag-iplookup","tag-powershell","item-wrap"],"_links":{"self":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/305","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=305"}],"version-history":[{"count":1,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions"}],"predecessor-version":[{"id":306,"href":"https:\/\/adsecurity.org\/index.php?rest_route=\/wp\/v2\/posts\/305\/revisions\/306"}],"wp:attachment":[{"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adsecurity.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}