{"id":200,"date":"2017-08-26T19:56:13","date_gmt":"2017-08-26T23:56:13","guid":{"rendered":"https:\/\/packetlost.com\/blog\/?p=200"},"modified":"2017-08-26T19:57:46","modified_gmt":"2017-08-26T23:57:46","slug":"verify-alwayson-read-only-secondary-replica-routing-with-powershell","status":"publish","type":"post","link":"https:\/\/packetlost.com\/blog\/2017\/08\/26\/verify-alwayson-read-only-secondary-replica-routing-with-powershell\/","title":{"rendered":"Verify AlwaysOn Read Only Secondary Replica Routing with PowerShell"},"content":{"rendered":"<p>Here is a quick gist which will return the SQL servers responding to the request to the PowerShell host.<\/p>\n<p>As written this needs to be run from PowerShell as a user with privileged sql access to run &#8220;select @@servername&#8221;. Make sure to target a non system database inside an availability group with <a href=\"https:\/\/docs.microsoft.com\/en-us\/sql\/database-engine\/availability-groups\/windows\/configure-read-only-routing-for-an-availability-group-sql-server\">read only routing configured<\/a>. The script can target a named instance by appending the instance name to the $server variable at the top.<\/p>\n<p>The first value returned is the server node responding to regular requests without application intent specified. The second value returned is the server node responding to readonly application intent requests.<\/p>\n<div class=\"oembed-gist\"><script src=\"https:\/\/gist.github.com\/Packet-Lost\/cbb8d791fa6042519339b672bd2b844d.js\"><\/script><noscript>View the code on <a href=\"https:\/\/gist.github.com\/Packet-Lost\/cbb8d791fa6042519339b672bd2b844d\">Gist<\/a>.<\/noscript><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Here is a quick gist which will return the SQL servers responding to the request to the PowerShell host. As written this needs to be run from PowerShell as a user with privileged sql access to run &#8220;select @@servername&#8221;. Make &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/packetlost.com\/blog\/2017\/08\/26\/verify-alwayson-read-only-secondary-replica-routing-with-powershell\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,49],"tags":[],"class_list":["post-200","post","type-post","status-publish","format-standard","hentry","category-powershell","category-sql"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/posts\/200","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/comments?post=200"}],"version-history":[{"count":2,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions"}],"predecessor-version":[{"id":202,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/posts\/200\/revisions\/202"}],"wp:attachment":[{"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/media?parent=200"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/categories?post=200"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/packetlost.com\/blog\/wp-json\/wp\/v2\/tags?post=200"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}