{"id":2936,"date":"2021-02-22T12:38:16","date_gmt":"2021-02-22T10:38:16","guid":{"rendered":"http:\/\/blog.hosebei.ch\/?p=2936"},"modified":"2021-02-22T12:38:16","modified_gmt":"2021-02-22T10:38:16","slug":"active-directory-find-closest-domain-controller-with-powershell","status":"publish","type":"post","link":"https:\/\/blog.hosebei.ch\/?p=2936","title":{"rendered":"Active Directory: Find closest Domain Controller with Powershell"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">You want to use the closest Domain Controller (DC) in you powershell script, then you can simply use this one-liner:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Get-ADDomainController -Discover -NextClosestSite<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The parameter -NextClosestSite does deliver you the closest Domain Controller, either in your Site, or in the best Site based on the Site link costs, based on the Microsoft Article about the cmdlet:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1467\" height=\"552\" src=\"http:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image.png?w=1024\" alt=\"\" class=\"wp-image-2940\" srcset=\"https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image.png 1467w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image-300x113.png 300w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image-1024x385.png 1024w, https:\/\/blog.hosebei.ch\/wp-content\/uploads\/2021\/02\/image-768x289.png 768w\" sizes=\"auto, (max-width: 1467px) 100vw, 1467px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Source: <a href=\"https:\/\/docs.microsoft.com\/en-us\/powershell\/module\/addsadministration\/get-addomaincontroller?view=win10-ps\">Get-ADDomainController<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You want to use the closest Domain Controller (DC) in you powershell script, then you can simply use this one-liner: Get-ADDomainController -Discover -NextClosestSite The parameter -NextClosestSite does deliver you the closest Domain Controller, either in your Site, or in the best Site based on the Site link costs, based on the Microsoft Article about the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-2936","post","type-post","status-publish","format-standard","hentry","category-configmgr"],"_links":{"self":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2936","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2936"}],"version-history":[{"count":0,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=\/wp\/v2\/posts\/2936\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2936"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2936"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hosebei.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2936"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}