{"id":3323,"date":"2023-02-21T15:46:08","date_gmt":"2023-02-21T21:46:08","guid":{"rendered":"https:\/\/microsoftgeek.com\/?p=3323"},"modified":"2023-02-21T16:23:42","modified_gmt":"2023-02-21T22:23:42","slug":"adding-dns-servers-in-all-dhcp-scopes-using-powershell","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=3323","title":{"rendered":"Adding DNS Servers in All DHCP Scopes using PowerShell"},"content":{"rendered":"\n<p>To Get all Scopes \u2013 Open PowerShell \u2013 Run as Administrator<\/p>\n\n\n\n<p>Get-DhcpServerv4Scope<\/p>\n\n\n\n<p>To Check DNS Servers Option 006<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group is-nowrap is-layout-flex wp-container-core-group-is-layout-6c531013 wp-block-group-is-layout-flex\">\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-table alignleft is-style-regular\"><table><tbody><tr><td><em>Get-DhcpServerv4Scope| Get-DhcpServerv4OptionValue| Where-Object{$_.OptionID -like6} | FT Value<\/em><\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><code><\/code><\/figcaption><\/figure>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.azure365pro.com\/wp-content\/uploads\/2019\/12\/image_thumb.png\" alt=\"image\" title=\"image\"\/><\/figure>\n\n\n\n<p>To Check \u2013 Whatif<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-regular\"><table><tbody><tr><td><em>Get-DhcpServerv4Scope| Set-DhcpServerv4OptionValue-DnsServer172.21.10.20,172.21.10.21,10.10.11.10,10.10.11.11 \u2013Whatif<\/em><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>To Apply<\/p>\n\n\n\n<p><em>Get-DhcpServerv4Scope| Set-DhcpServerv4OptionValue-DnsServer172.21.10.20,172.21.10.21,10.10.11.10,10.10.11.11<\/em><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>To Check if its Applied or Not<\/p>\n\n\n\n<p><em>Get-DhcpServerv4Scope| Get-DhcpServerv4OptionValue| Where-Object{$_.OptionID -like6} | FT Value<\/em><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>You can see 006 DNS Servers Updated for all scopes<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.azure365pro.com\/wp-content\/uploads\/2019\/12\/image_thumb-1.png\" alt=\"image\" title=\"image\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>To Get all Scopes \u2013 Open PowerShell \u2013 Run as Administrator Get-DhcpServerv4Scope To Check DNS Servers Option 006 Get-DhcpServerv4Scope| Get-DhcpServerv4OptionValue| Where-Object{$_.OptionID -like6} | FT Value To Check \u2013 Whatif Get-DhcpServerv4Scope| Set-DhcpServerv4OptionValue-DnsServer172.21.10.20,172.21.10.21,10.10.11.10,10.10.11.11 \u2013Whatif To Apply Get-DhcpServerv4Scope| Set-DhcpServerv4OptionValue-DnsServer172.21.10.20,172.21.10.21,10.10.11.10,10.10.11.11 To Check if its Applied or Not Get-DhcpServerv4Scope| Get-DhcpServerv4OptionValue| Where-Object{$_.OptionID -like6} | FT Value You can see 006 DNS [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,45,57,63,74],"tags":[],"class_list":["post-3323","post","type-post","status-publish","format-standard","hentry","category-ad","category-domain-name-system-dns","category-dhcp","category-server-2016-2016","category-windows-server-2019"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3323"}],"version-history":[{"count":16,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3323\/revisions"}],"predecessor-version":[{"id":3346,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3323\/revisions\/3346"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}