{"id":1946,"date":"2016-02-01T05:57:01","date_gmt":"2016-02-01T13:57:01","guid":{"rendered":"http:\/\/www.coretechnologies.com\/blog\/?p=1946"},"modified":"2024-02-18T07:54:38","modified_gmt":"2024-02-18T15:54:38","slug":"windows-service-forgets-password","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/windows-services\/windows-service-forgets-password\/","title":{"rendered":"Why does my Windows Service keep forgetting its password?"},"content":{"rendered":"<h2 style=\"margin-top:0px;\"><b>The mystery: &#8220;The service did not start due to a login failure&#8221;<\/b><\/h2>\n<p>One of our customers reported a very strange problem last week. After about a day of running flawlessly, their windows service would suddenly fail to start after a reboot. The error reported by the <a href=\"\/blog\/windows-services\/event-viewer-troubleshoot-windows-services\/\">Event Viewer<\/a> hinted at a problem with the service user&#8217;s account:<br \/>\n<a href=\"\/blog\/images\/windows-service-logon-failure-error.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Windows Service Logon Failure\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"\/blog\/images\/windows-service-logon-failure-error.png\" border=\"0\" title=\"Windows Service Logon Failure (click to enlarge)\" alt=\"Windows Service Logon Failure\" width=\"520\" \/><\/a>\n<\/p>\n<p>Trying to start the service directly from the <a href=\"\/blog\/windows-services\/essential-tools-windows-services-msc\/\">Windows Services Control Panel application<\/a> produced the same unsatisfying result:<br \/>\n<a href=\"\/blog\/images\/windows-service-failed-to-start-error-1069.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Windows service failed to start\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/windows-service-failed-to-start-error-1069.png\" width=\"461\" height=\"200\" border=\"0\" title=\"Windows service failed to start (click to enlarge)\" alt=\"Windows service failed to start\" \/><\/a>\n<\/p>\n<p>The service account&#8217;s password had not changed, and the user had no problem logging into the server interactively. Why was the windows service failing to login?<\/p>\n<p>Luckily we were able to get the service going again by re-entering the user&#8217;s password:<br \/>\n<a href=\"\/blog\/images\/service-set-logon-password.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Re-enter windows service password\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/service-set-logon-password.png\" width=\"420\" height=\"475\" border=\"0\" title=\"Re-enter windows service password (click to enlarge)\" alt=\"Re-enter windows service password\" \/><\/a>\n<\/p>\n<p>When doing so, we noticed that the &#8220;Log on as a service&#8221; right had to be granted again. Very suspicious&#8230;<br \/>\n<a href=\"\/blog\/images\/log-on-as-a-service-right-granted.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Log on as service granted\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/log-on-as-a-service-right-granted.png\" width=\"480\" height=\"172\" border=\"0\" title=\"Log on as service granted (click to enlarge)\" alt=\"Log on as service granted\" \/><\/a>\n<\/p>\n<p>But a mere 24 hours later, the problem resurfaced! Once again, the service failed to start after a reboot.<\/p>\n<h2><b>The problem: Group Policy overwriting Local Policy<\/b><\/h2>\n<p>The message about the &#8220;Log on as a service&#8221; right lead us to the root of the problem.<\/p>\n<p>Entering the password in services.msc updated the user&#8217;s rights in the machine&#8217;s Local <a href=\"https:\/\/en.wikipedia.org\/wiki\/Group_Policy\">Group Policy<\/a> &#8212; a collection of settings that define how the system will behave for the PC&#8217;s users. However, since the user and server were part of a domain, those local settings were <b>periodically overwritten by the domain&#8217;s group policy<\/b>, which had <b>not<\/b> been updated with the new permission. And because the necessary permission &#8220;disappeared&#8221; on the machine, the service failed the next time it tried to start.<\/p>\n<p><a name=\"update-group-policy\"><\/a><\/p>\n<h2><b>The solution: Modify the Domain Group Policy<\/b><\/h2>\n<p>To fix the problem, we must update the domain group policy and explicitly give the service user the &#8220;Log on as a service&#8221; right. To do so:<\/p>\n<ol>\n<li>\n<p>Start the <b>Group Policy Management<\/b> application.<\/p>\n<p>Open Control Panel, navigate to <b>System and Security &gt; Administrative Tools<\/b>, and double-click <b>Group Policy Management<\/b> on the left.<br \/>\n<a href=\"\/blog\/images\/start-group-policy-management.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Start Group Policy Management\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"\/blog\/images\/start-group-policy-management.png\" border=\"0\" title=\"Start Group Policy Management (click to enlarge)\" alt=\"Start Group Policy Management\" width=\"520\" \/><\/a>\n<\/p>\n<p>(Note: Don&#8217;t search for &#8220;group&#8221; in Control Panel. That will lead you to the &#8220;Edit group policy&#8221; link, which opens the <b>local<\/b> group policy!)<\/p>\n<\/li>\n<li>\n<p>Find your default domain policy on the left. Right-click it and select <b>Edit<\/b> to bring up the <b>Group Policy Management Editor<\/b> window.<br \/>\n<a href=\"\/blog\/images\/edit-default-domain-policy.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Edit the default domain policy\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"\/blog\/images\/edit-default-domain-policy.png\" border=\"0\" title=\"Edit the default domain policy (click to enlarge)\" alt=\"Edit the default domain policy\" width=\"520\" \/><\/a>\n<\/p>\n<\/li>\n<li>\n<p>On the left, navigate to <b>Computer Configuration &gt; Policies &gt; Windows Settings &gt; Security Settings &gt; Local Policies &gt; User Rights Assignment<\/b> and select<br \/>\nthe <b>Log on as a service<\/b> entry on the right.<br \/>\n<a href=\"\/blog\/images\/edit-group-policy-user-rights.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Edit group policy user rights\" target=\"_blank\"><br \/>\n<img decoding=\"async\" src=\"\/blog\/images\/edit-group-policy-user-rights.png\" border=\"0\" title=\"Edit group policy user rights (click to enlarge)\" alt=\"Edit group policy user rights\" width=\"520\" \/><\/a>\n<\/p>\n<\/li>\n<li>\n<p>Double-click <b>Log on as a service<\/b> to bring up its <b>Properties<\/b> window.<\/p>\n<p>Add the user running your windows service to the list and click OK to record the change.<br \/>\n<a href=\"\/blog\/images\/add-domain-user-log-on-as-a-service.png\" class=\"zoomPopup\" rel=\"zoomgroup noopener noreferrer\" title=\"Add the domain account running the windows service\" target=\"_blank\"><br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"\/blog\/images\/add-domain-user-log-on-as-a-service.png\" width=\"431\" height=\"514\" border=\"0\" title=\"Add the domain account running the windows service (click to enlarge)\" alt=\"Add the domain account running the windows service\" \/><\/a>\n<\/p>\n<\/li>\n<\/ol>\n<p><\/p>\n<p>Next time your domain policy is copied to your server, it will bring along the Log on as a service right for the user. You shouldn&#8217;t encounter the &#8220;logon failure&#8221; error again!<\/p>\n<h2><b>A closing note for the folks at Microsoft: A better error message please!<\/b><\/h2>\n<p><b><\/b>Instead of reporting the generic &#8220;logon failure&#8221;, why not be more precise and say something like <b>&#8220;The user doesn&#8217;t have the necessary rights to start the service&#8221;<\/b>? You could provide even more guidance by listing the missing rights.<\/p>\n<p>The bottom line is a that a helpful error message highlighting the true problem would have led us straight to the solution and avoided a few anxious days for us and our client.<\/p>\n<!-- relpost-thumb-wrapper --><div class=\"relpost-thumb-wrapper\"><!-- filter-class --><div class=\"relpost-thumb-container\"><style>.relpost-block-single-image, .relpost-post-image { margin-bottom: 10px; }<\/style><h3>You may also like...<\/h3><div style=\"clear: both\"><\/div><div style=\"clear: both\"><\/div><!-- relpost-block-container --><div class=\"relpost-block-container relpost-block-column-layout\" style=\"--relposth-columns: 3;--relposth-columns_t: 2; --relposth-columns_m: 2\"><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/how-to-restart-at-specific-time\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: How do I Restart my Windows Service at a Specific Time every Week?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/restart-service-schedule-150x150-1.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Q&amp;A: How do I Restart my Windows Service at a Specific Time every Week?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/power\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Essential Windows Services: Power\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/power-150x150.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Essential Windows Services: Power<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/alwaysup\/turbocharge-windows-services\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Turbocharge your Applications Running as Windows Services with AlwaysUp\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/turbocharge-windows-service-thumbnail.png\" style=\"aspect-ratio:1\/1\" style=\"aspect-ratio:1\/1\"><\/img><div class=\"relpost-block-single-text\"  style=\"height: 75px;font-family: Arial;  font-size: 12px;  color: #333333;\"><h2 class=\"relpost_card_title\">Turbocharge your Applications Running as Windows Services with AlwaysUp<\/h2><\/div><\/div><\/a><\/div><!-- close relpost-block-container --><div style=\"clear: both\"><\/div><\/div><!-- close filter class --><\/div><!-- close relpost-thumb-wrapper -->","protected":false},"excerpt":{"rendered":"<p>The mystery: &#8220;The service did not start due to a login failure&#8221; One of our customers reported a very strange problem last week. After about a day of running flawlessly, their windows service would suddenly fail to start after a &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/windows-service-forgets-password\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":8567,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[86,99,196],"class_list":["post-1946","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows-services","tag-group-policy","tag-logon-failure","tag-windows-services-2"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1946","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/comments?post=1946"}],"version-history":[{"count":2,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1946\/revisions"}],"predecessor-version":[{"id":12417,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/1946\/revisions\/12417"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/8567"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=1946"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=1946"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=1946"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}