{"id":1451,"date":"2018-06-13T12:18:16","date_gmt":"2018-06-13T02:18:16","guid":{"rendered":"http:\/\/ntsblog.homedev.com.au\/?p=1451"},"modified":"2019-09-22T00:20:58","modified_gmt":"2019-09-21T14:20:58","slug":"reset-sql-server-sa-login-via-powershell","status":"publish","type":"post","link":"https:\/\/ntsblog.homedev.com.au\/index.php\/2018\/06\/13\/reset-sql-server-sa-login-via-powershell\/","title":{"rendered":"Reset SQL Server SA Login via Powershell"},"content":{"rendered":"<div id=\"ntsbl-3330825924\" class=\"ntsbl-before-content ntsbl-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-6288941070289539\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:728px;height:90px;\" \ndata-ad-client=\"ca-pub-6288941070289539\" \ndata-ad-slot=\"9356781486\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><h2>The Problem<\/h2>\n<p>You have lost or forgotten the SA password for you SQL Server box!!<\/p>\n<h2>The solution<\/h2>\n<p>This is really easy to fix.<br \/>\nOn the server do the following:<\/p>\n<ol>\n<li>Launch Powershell as an administrator<\/li>\n<li>Run:\n<pre>Install-Module dbatools<\/pre>\n<\/li>\n<li>Answer &#8220;Y&#8221; when prompted (twice for me).<\/li>\n<li>Run\n<pre>Reset-DbaAdmin -SqlServer localhost\\SQLEXPRESSS<\/pre>\n<p>(or whatever your database is, a &#8220;.&#8221; will suffice for a standard default sql installation&#8221;)<\/li>\n<li>Answer &#8220;Y&#8221; to the prompts<\/li>\n<li>Enter your new sa password when prompted<\/li>\n<li>Wait<\/li>\n<\/ol>\n<p>That should be it.<br \/>\nTry logging in as &#8220;sa&#8221; with your new password and you can now are good to go.<\/p>\n<p>Full details of the dbatools can be found here; <a href=\"https:\/\/dbatools.io\/functions\/other\/reset-dbaadmin\/\">https:\/\/dbatools.io\/functions\/other\/reset-dbaadmin\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Problem You have lost or forgotten the SA password for you SQL Server box!! The solution This is really easy to fix. On the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1451","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/1451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=1451"}],"version-history":[{"count":0,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/1451\/revisions"}],"wp:attachment":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=1451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=1451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=1451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}