{"id":4850,"date":"2023-08-30T17:49:46","date_gmt":"2023-08-30T15:49:46","guid":{"rendered":"https:\/\/leeryanrs.com\/?p=4850"},"modified":"2023-08-30T17:49:46","modified_gmt":"2023-08-30T15:49:46","slug":"report-of-dns-settings-on-all-windows-servers-via-powershell","status":"publish","type":"post","link":"https:\/\/leeryanrs.com\/?p=4850","title":{"rendered":"Report of DNS settings on all Windows Servers via powershell"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>$AllServers=Get-ADComputer -Filter {OperatingSystem -Like \"Windows Server*\" -and Enabled -eq 'True'}\n$Servers = ForEach ($Server in $AllServers){\n\n$Result=Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter \"IPEnabled = 'True'\" -Property DNSServerSearchOrder -ComputerName $Server.Name\n\nNew-Object -TypeName PSObject -Property @{\nComputerName = $Server.Name -join ','\nDNSServerSearchOrder = $Result.DNSServerSearchOrder -join ','\n\n} | Select-Object ComputerName,DNSServerSearchOrder | Export-Csv -Path C:\\Temp\\ServerDNSSettings.csv -NoTypeInformation -Append\n}<\/code><\/pre>\n\n\n\n<p>Run this from a domain controller and it will report the DNS servers set on the NIC card.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Run this from a domain controller and it will report the DNS servers set on the NIC card.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,13,15,19],"tags":[38,43,45,51],"class_list":["post-4850","post","type-post","status-publish","format-standard","hentry","category-powershell","category-script","category-server","category-windows","tag-powershell","tag-script","tag-server","tag-windows"],"_links":{"self":[{"href":"https:\/\/leeryanrs.com\/index.php?rest_route=\/wp\/v2\/posts\/4850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leeryanrs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/leeryanrs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/leeryanrs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leeryanrs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4850"}],"version-history":[{"count":0,"href":"https:\/\/leeryanrs.com\/index.php?rest_route=\/wp\/v2\/posts\/4850\/revisions"}],"wp:attachment":[{"href":"https:\/\/leeryanrs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/leeryanrs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4850"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/leeryanrs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}