{"id":10317,"date":"2021-06-21T19:26:25","date_gmt":"2021-06-22T02:26:25","guid":{"rendered":"https:\/\/www.coretechnologies.com\/blog\/?p=10317"},"modified":"2022-04-03T23:01:25","modified_gmt":"2022-04-04T06:01:25","slug":"top-3-srvany-problems","status":"publish","type":"post","link":"https:\/\/www.coretechnologies.com\/blog\/srvany\/top-3-srvany-problems\/","title":{"rendered":"The Top 3 Real-World Problems with Microsoft Srvany"},"content":{"rendered":"<div align=\"center\"><img loading=\"lazy\" decoding=\"async\" class=\"no-lazy-load\" src=\"\/blog\/images\/service-caution-150x150.webp\" style=\"margin-bottom:20px;\" title=\"3 Serious Problems with Microsoft Srvany\" alt=\"3 Serious Problems with Microsoft Srvany\" border=\"0\" width=\"150\" height=\"150\" \/><\/div>\n<p>Despite being almost 20 years old, Microsoft&#8217;s free <a href=\"\/WindowsServices\/FAQ.html#WhatIsSrvany\">Srvany utility<\/a> is still a surprisingly popular tool. Every week, we come across at least one person using the ancient <a href=\"https:\/\/en.wikipedia.org\/wiki\/Service_wrapper\" target=\"_blank\" rel=\"noopener\">service wrapper<\/a> to install an executable or batch file to start at boot as a Windows Service.<\/p>\n<p>Truthfully, Srvany is fine for many situations. It&#8217;s basic, and it works. And the price is right.<\/p>\n<p>However, the utility has several shortcomings that aren&#8217;t immediately obvious. Here are the top 3 that we (and our customers) have encountered over the years:<\/p>\n<h2 class=\"blog-caption\">Problem #1: Srvany may continue to run even though your application is dead<\/h2>\n<p>When it is started, a Srvany service immediately launches its target application. And if the application starts properly and runs without interruption, everything is great.<\/p>\n<p>But what happens if the application crashes or stops running?<\/p>\n<p>To find out, we created a new service that runs the Windows Notepad text editor:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/notepad-windows-service.png\" class=\"zoomPopup\" title=\"Notepad Windows Service installed\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/notepad-windows-service.png\" title=\"Notepad Windows Service installed (click to enlarge)\" alt=\"Notepad Windows Service installed\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<p>When we started the service, Srvany launched notepad.exe as instructed. Here you can see the service in the &#8220;Running&#8221; state with Notepad operating in Session 0:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/srvany-notepad-service-running.png\" class=\"zoomPopup\" title=\"Srvany running Notepad as a service\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/srvany-notepad-service-running.png\" title=\"Srvany running Notepad as a service (click to enlarge)\" alt=\"Srvany running Notepad as a service\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<p>Next, we forcibly terminated Notepad.exe. As expected, the process disappeared.<\/p>\n<p>However, even after Notepad had exited, the service remained in the &#8220;Running&#8221; state. Misleading, to say the least.<\/p>\n<p>Basically, you cannot rely on the state of a Srvany service to reflect the state of the target application. <b>Just because the service says its running doesn&#8217;t mean that the application is!<\/b><\/p>\n<h2 class=\"blog-caption\">Problem #2: Srvany may leave your application running after the service stops<\/h2>\n<p>As described in <a href=\"\/blog\/srvany\/stop-srvany-service\/\">this article<\/a>, when you stop a Srvany service, only the target application is closed. If the target application had launched other applications, those others will not be stopped.<\/p>\n<p>This can be a problem for batch files and applications involving multiple processes.<\/p>\n<p>To illustrate, we installed a new Srvany service that runs a batch file. The batch file starts Notepad:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/srvany-batch-file-service.png\" class=\"zoomPopup\" title=\"Batch file Windows Service installed\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/srvany-batch-file-service.png\" title=\"Batch file Windows Service installed (click to enlarge)\" alt=\"Batch file Windows Service installed\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<p>When we started the service, Srvany launched the batch file, which started Notepad. So far so good:<\/p>\n<div align=\"center\"><a href=\"\/blog\/images\/srvany-running-batch-file-processes.png\" class=\"zoomPopup\" title=\"Srvany running a Batch File as a service\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"image-padding\" src=\"\/blog\/images\/srvany-running-batch-file-processes.png\" title=\"Srvany running a Batch File as a service (click to enlarge)\" alt=\"Srvany running a Batch File as a service\" border=\"0\" width=\"520\" \/><\/a><\/div>\n<p>However, when we stopped the service, <b>only the batch file (cmd.exe) was terminated<\/b>. Notepad continued to run, alive and well &mdash; despite the service being in the stopped state.<\/p>\n<p>Here again, the state of the service does not reflect the state of the target application. But there are unwelcome side effects too.<\/p>\n<p>If we start the service again, Srvany will launch a fresh copy of Notepad. And then we have <b>two copies of Notepad running<\/b>. This &#8220;duplicate&#8221; scenario can create chaos for more complex situations, for example with applications that should not run multiple instances. Watch out!<\/p>\n<h2 class=\"blog-caption\">Problem #3: Srvany isn&#8217;t particularly user friendly<\/h2>\n<p>According to our customers, Srvany comes up short in three areas of usability:<\/p>\n<ol>\n<li>\n<p><b>There is no GUI<\/b> to install your application as a service. You must use a separate command line tool (<a href=\"https:\/\/docs.microsoft.com\/en-us\/troubleshoot\/windows-client\/deployment\/create-user-defined-service\" target=\"_blank\" rel=\"noopener\">Instsrv<\/a>) to create a new Srvany service, which is less than ideal.<\/p>\n<\/li>\n<li>\n<p>To configure the application to run, you have to <b>create keys and values with the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Windows_Registry\" target=\"_blank\" rel=\"noopener\">Windows Registry Editor<\/a><\/b> &mdash; an administrative tool that can cripple your PC if you use it incorrectly.<\/p>\n<\/li>\n<li>\n<p>Srvany is difficult to troubleshoot because it <b>doesn&#8217;t write a log file or provide helpful feedback when things go wrong<\/b>. As a result, frustration often ensues.<\/p>\n<\/li>\n<\/ol>\n<p style=\"margin-top:30px;\">\nProceed with caution!<\/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\/alwaysup\/see-java-console\/\"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 can I see my Java Console Window when Running as a Service with AlwaysUp?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/qa-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\">Q&amp;A: How can I see my Java Console Window when Running as a Service with AlwaysUp?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/what-services-changed\/\"class=\"relpost-block-single\" ><div class=\"relpost-custom-block-single\"><img decoding=\"async\" loading=\"lazy\" class=\"relpost-block-single-image\" alt=\"Q&amp;A: What changed with my Windows Services?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/windows-service-changes-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: What changed with my Windows Services?<\/h2><\/div><\/div><\/a><a href=\"https:\/\/www.coretechnologies.com\/blog\/windows-services\/restart-remote-service\/\"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 a Windows Service on a Remote Computer?\"  src=\"https:\/\/www.coretechnologies.com\/blog\/wp-content\/uploads\/restart-remote-service-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 a Windows Service on a Remote Computer?<\/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>Despite being almost 20 years old, Microsoft&#8217;s free Srvany utility is still a surprisingly popular tool. Every week, we come across at least one person using the ancient service wrapper to install an executable or batch file to start at &hellip; <a href=\"https:\/\/www.coretechnologies.com\/blog\/srvany\/top-3-srvany-problems\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":10337,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[242],"tags":[244,243,196],"class_list":["post-10317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-srvany","tag-service-wrapper","tag-srvany","tag-windows-services-2"],"_links":{"self":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10317","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=10317"}],"version-history":[{"count":25,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10317\/revisions"}],"predecessor-version":[{"id":11149,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/posts\/10317\/revisions\/11149"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media\/10337"}],"wp:attachment":[{"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/media?parent=10317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/categories?post=10317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.coretechnologies.com\/blog\/wp-json\/wp\/v2\/tags?post=10317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}