{"id":2698,"date":"2017-06-20T17:15:57","date_gmt":"2017-06-20T14:15:57","guid":{"rendered":"http:\/\/www.systemcodegeeks.com\/?p=2698"},"modified":"2017-06-19T17:53:12","modified_gmt":"2017-06-19T14:53:12","slug":"managing-windows-services-cli","status":"publish","type":"post","link":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/","title":{"rendered":"Managing Windows Services from CLI"},"content":{"rendered":"<p>In this short guide, I&#8217;ll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers.  It should also go without saying that &#8220;services&#8221; are an integral part of pretty much all computer systems.  You should also be aware that &#8220;services&#8221; are sometimes referred to as daemons (pronounced &#8220;demons&#8221;), especially in various *nix-based operating systems.<\/p>\n<div class=\"toc\">\n<h3>Table of Contents<\/h3>\n<dl>\n<dt><a href=\"#step1\">1. Managing Windows Services Introduction<\/a><\/dt>\n<dt><a href=\"#step2\">2. My List of Tools\/Utilities to Manage Services<\/a><\/dt>\n<dd>\n<dl>\n<dt><a href=\"#step2.1\">2.1. Native Windows Tools<\/a><\/dt>\n<dt><a href=\"#step2.2\">2.2. Third-Party and\/or Non-Native Tools<\/a><\/dt>\n<dt><a href=\"#step2.3\">2.3. Bonus: Extra Tools &amp; Tips<\/a><\/dt>\n<\/dl>\n<\/dd>\n<dt><a href=\"#step3\">3. Summary<\/a><\/a><\/dt>\n<\/dl>\n<\/div>\n<h2><a name=\"step1\"><\/a>1. Managing Windows Services Introduction<\/h2>\n<p>There are multiple ways to manage\/administer services on Windows workstations and servers, and whichever method(s) you choose to use is generally based on speed\/efficiency, and user preference.  For instance, while I <em>do<\/em>&nbsp; find myself using PowerShell occasionally for a variety of different tasks, I personally always look for simpler, faster alternatives where applicable (batch script, psexec, winrs, wmic, etc).  Reason being is that I&#8217;ve had so many times where I&#8217;ve found code examples online that either contain way more characters and\/or lines of code than other methods, or the PowerShell examples I find online don&#8217;t always work, or the code examples simply fail with various errors (not to mention missing pre-requisites).  I&#8217;m not bashing PowerShell by any means, but I also won&#8217;t spend 30 minutes trying to get multiple lines of complex PowerShell code to work when I can accomplish the same task in a few seconds with a simple one-line batch command.<\/p>\n<p><strong>NOTE 1:<\/strong>&nbsp; There are several other management tasks that can be performed when managing services (creating, pausing, etc), but I&#8217;ve chosen to cover the ones that I feel will be most relevant and common to someone who&#8217;s reading this document.<\/p>\n<p><strong>NOTE 2:<\/strong>&nbsp; Since a lot of the commands I&#8217;m going to be covering need to be entered in an administrative command prompt, I would recommend typing them all from an admin prompt (using the &#8220;RunAs Administrator&#8221; option when launching &#8220;CMD&#8221;).<\/p>\n<p>The main tasks that I&#8217;ll be covering with regards to managing services are:<\/p>\n<ul>\n<li>modify or delete<\/li>\n<li>start or stop<\/li>\n<li>query<\/li>\n<\/ul>\n<p>That may not sound like much, but there&#8217;s a surprising amount of detail in those five distinct tasks (and I&#8217;ll even throw in a few bonuses along the way!).<\/p>\n<p>I&#8217;ll cover these options in more detail as we continue through this guide.<\/p>\n<h2><a name=\"step2\"><\/a>2. My List of Tools\/Utilities to Manage Services<\/h2>\n<p>There&#8217;s a variety of tools that can be used, and there are likely other tools that I&#8217;m unaware of that could also be used to manage services, but I&#8217;m only going to list the ones that I use or am familiar with.  The rabbit hole can go real deep on this subject, but I&#8217;ll be covering a lot of helpful and relevant information, so stick around and keep reading!<\/p>\n<h3><a name=\"step2.1\"><\/a>2.1. Native Windows Tools<\/h3>\n<ul>\n<li>(2.1.1.) <strong><span style=\"text-decoration: underline\">SC<\/span><\/strong>:&nbsp;  &#8220;SC&#8221; stands for &#8220;service controller&#8221;.<\/li>\n<li>(2.1.2.) <strong><span style=\"text-decoration: underline\">NET<\/span><\/strong>:&nbsp;  &#8220;NET&#8221; essentially stands for &#8220;network&#8221;, and as such, it can be used to manage network resources.<\/li>\n<p>&nbsp;&nbsp;<strong>NOTE:<\/strong>&nbsp; NET can only be used locally, whereas SC can be used locally <strong>and<\/strong> remotely.<\/p>\n<li>(2.1.3.) <strong><span style=\"text-decoration: underline\">WMIC<\/span><\/strong>:&nbsp;  &#8220;WMIC&#8221; stands for &#8220;Windows Management Instrumentation Command-line&#8221;.<\/li>\n<li>(2.1.4.) <strong><span style=\"text-decoration: underline\">PowerShell<\/span><\/strong>:&nbsp;  A task automation and configuration management framework.<\/li>\n<\/ul>\n<h3><a name=\"step2.2\"><\/a>2.2. Third-Party and\/or Non-Native Tools<\/h3>\n<ul>\n<li>(2.2.1.) <span style=\"text-decoration: underline\"><strong><a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/psservice.aspx\" target=\"_blank\">PsService<\/a><\/strong><\/span>:&nbsp;  The &#8220;Ps&#8221; in all of the various PsTools got its name due to the fact that the standard UNIX process listing command-line tool is named &#8220;ps&#8221;, so Mark Russinovich (the creator of the <strong><a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/pstools.aspx\" target=\"_blank\">PsTools<\/a><\/strong> suite) adopted this prefix for all the tools in order to tie them together into a suite of tools named PsTools.  One of the nice features of PsService is that you can input credentials for authentication! (this is not possible with SC)<\/li>\n<li>(2.2.2.) <span style=\"text-decoration: underline\"><strong><a href=\"http:\/\/www.intelliadmin.com\/RemoteService.exe\" target=\"_blank\">RemoteService<\/a><\/strong><\/span>:&nbsp; It&#8217;s not natively possible to restart services remotely <em><strong>AND<\/strong><\/em>&nbsp; input credentials for authentication, but this tool can! (just like PsService)<\/li>\n<\/ul>\n<h3><a name=\"step2.3\"><\/a>2.3. Bonus: Extra Tools &amp; Tips<\/h3>\n<ul>\n<li>(2.3.1.) <span style=\"text-decoration: underline\"><strong><a href=\"https:\/\/technet.microsoft.com\/en-us\/sysinternals\/pxexec.aspx\" target=\"_blank\">PsExec<\/a><\/strong><\/span>:&nbsp;  PsExec is also part of the PsTools suite, and it can be used in combination with other tools.<\/li>\n<li>(2.3.2.) <strong><span style=\"text-decoration: underline\">WinRS<\/span><\/strong>:&nbsp;  &#8220;WinRS&#8221; stands for Windows Remote Shell, and it&#8217;s a natively available tool in Windows.  WinRS can also be used in combination with other tools.<\/li>\n<\/ul>\n<p>Alright, let&#8217;s begin looking at each of these tools!<\/p>\n<h3><em>(2.1. Native Windows Tools)<\/em><\/h3>\n<h4>2.1.1. SC<\/h4>\n<p><strong>NOTE:<\/strong>&nbsp; One major difference between SC and NET is this:  SC will send a control request to a service and then immediately return to the prompt, whereas NET will wait for the service to respond before it returns to the prompt.  What&#8217;s the significance of this?  If anything, it&#8217;s at least good to know that NET will do the work for you in terms of &#8220;the waiting game&#8221;, whereas SC will tell you what it did, but it&#8217;s up to you to make sure it was successful.  Don&#8217;t let this info be a deterrent though when it comes to using SC.  SC is an amazing little utility that you&#8217;ll really enjoy using!<\/p>\n<p>The native help for SC is as follows:<\/p>\n<pre class=\"brush:plain\">\r\nUSAGE:\r\n        sc  [command] [service name]  ...\r\n\r\n        The option  has the form \"\\\\ServerName\"\r\n        Further help on commands can be obtained by typing: \"sc [command]\"\r\n        Commands:\r\n          query-----------Queries the status for a service, or enumerates the status for types of services.\r\n          queryex---------Queries the extended status for a service, or enumerates the status for types of services.\r\n          start-----------Starts a service.\r\n          pause-----------Sends a PAUSE control request to a service.\r\n          interrogate-----Sends an INTERROGATE control request to a service.\r\n          continue--------Sends a CONTINUE control request to a service.\r\n          stop------------Sends a STOP request to a service.\r\n          config----------Changes the configuration of a service (persistent).\r\n          description-----Changes the description of a service.\r\n          failure---------Changes the actions taken by a service upon failure.\r\n          failureflag-----Changes the failure actions flag of a service.\r\n          sidtype---------Changes the service SID type of a service.\r\n          privs-----------Changes the required privileges of a service.\r\n          qc--------------Queries the configuration information for a service.\r\n          qdescription----Queries the description for a service.\r\n          qfailure--------Queries the actions taken by a service upon failure.\r\n          qfailureflag----Queries the failure actions flag of a service.\r\n          qsidtype--------Queries the service SID type of a service.\r\n          qprivs----------Queries the required privileges of a service.\r\n          qtriggerinfo----Queries the trigger parameters of a service.\r\n          qpreferrednode--Queries the preferred NUMA node of a service.\r\n          delete----------Deletes a service (from the registry).\r\n          create----------Creates a service. (adds it to the registry).\r\n          control---------Sends a control to a service.\r\n          sdshow----------Displays a service's security descriptor.\r\n          sdset-----------Sets a service's security descriptor.\r\n          showsid---------Displays the service SID string corresponding to an arbitrary name.\r\n          triggerinfo-----Configures the trigger parameters of a service.\r\n          preferrednode---Sets the preferred NUMA node of a service.\r\n          GetDisplayName--Gets the DisplayName for a service.\r\n          GetKeyName------Gets the ServiceKeyName for a service.\r\n          EnumDepend------Enumerates Service Dependencies.\r\n\r\n        The following commands don't require a service name:\r\n        sc   \r\n          boot------------(ok | bad) Indicates whether the last boot should be saved as the last-known-good boot configuration\r\n          Lock------------Locks the Service Database\r\n          QueryLock-------Queries the LockStatus for the SCManager Database\r\nEXAMPLE:\r\n        sc start MyService\r\n\r\nQUERY and QUERYEX OPTIONS:\r\n        If the query command is followed by a service name, the status for that service is returned.  Further options do not apply in this case.  If the query command is followed by nothing or one of the options listed below, the services are enumerated.\r\n\r\n    type=    Type of services to enumerate (driver, service, all)\r\n             (default = service)\r\n    state=   State of services to enumerate (inactive, all)\r\n             (default = active)\r\n    bufsize= The size (in bytes) of the enumeration buffer\r\n             (default = 4096)\r\n    ri=      The resume index number at which to begin the enumeration\r\n             (default = 0)\r\n    group=   Service group to enumerate\r\n             (default = all groups)\r\n\r\nSYNTAX EXAMPLES\r\nsc query                - Enumerates status for active services &amp; drivers\r\nsc query eventlog       - Displays status for the eventlog service\r\nsc queryex eventlog     - Displays extended status for the eventlog service\r\nsc query type= driver   - Enumerates only active drivers\r\nsc query type= service  - Enumerates only Win32 services\r\nsc query state= all     - Enumerates all services &amp; drivers\r\nsc query bufsize= 50    - Enumerates with a 50 byte buffer\r\nsc query ri= 14         - Enumerates with resume index = 14\r\nsc queryex group= \"\"    - Enumerates active services not in a group\r\nsc query type= interact - Enumerates all interactive services\r\nsc query type= driver group= NDIS     - Enumerates all NDIS drivers\r\n<\/pre>\n<p>As you can see, there&#8217;s a decent amount of options, so I&#8217;m not going to be covering every detail of what you could do with SC.  I will however provide some examples of how I personally utilize it.<\/p>\n<p>In this next section, I&#8217;m going to show you some basic SC examples.<\/p>\n<h4>2.1.1a. SC &#8220;Query&#8221;<\/h4>\n<p>Anytime you want to know what services are installed on a computer, you can use the <code>query<\/code> command.  If you simply run <code>sc query<\/code>, you&#8217;ll get a long list of every service that is installed <em>and<\/em>&nbsp; running. Here&#8217;s an example command with one section of output (I&#8217;m only listing one service result as an example because the entire list would be overkill for this demonstration):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc query\r\n\r\nSERVICE_NAME: AeLookupSvc\r\nDISPLAY_NAME: Application Experience\r\n        TYPE               : 20  WIN32_SHARE_PROCESS\r\n        STATE              : 4  RUNNING\r\n                                (STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x0\r\n<\/pre>\n<p>Or if you&#8217;d like to discover every service that&#8217;s installed, whether it&#8217;s running or not, you can use <code>sc query state= all<\/code>.  Here&#8217;s an example (again, with only one section of output):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc query state= all\r\n\r\nSERVICE_NAME: WwanSvc\r\nDISPLAY_NAME: WWAN AutoConfig\r\n        TYPE               : 20  WIN32_SHARE_PROCESS\r\n        STATE              : 1  STOPPED\r\n        WIN32_EXIT_CODE    : 1077  (0x435)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x0\r\n<\/pre>\n<p>If you&#8217;d like to query a remote workstation, simply add <code>\\\\&lt;computername&gt;<\/code> like this:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\&lt;computername&gt; query state= all\r\n\r\n(of course you'll want to substitute &lt;computername&gt; with the actual computer name)\r\n<\/pre>\n<p>If you&#8217;re looking for a specific service, you can use <code>sc query &lt;service_name&gt;<\/code>.  Here&#8217;s an example of querying the &#8220;WWAN AutoConfig&#8221; service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc query wwansvc\r\n\r\nSERVICE_NAME: wwansvc\r\n        TYPE               : 20  WIN32_SHARE_PROCESS\r\n        STATE              : 1  STOPPED\r\n        WIN32_EXIT_CODE    : 1077  (0x435)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x0\r\n<\/pre>\n<p>If you&#8217;d like to see the configuration information for a specific service, you can use <code>sc qc &lt;service_name&gt;<\/code>.  Here&#8217;s an example of querying the configuration info for the &#8220;WWAN AutoConfig&#8221; service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc qc wwansvc\r\n[SC] QueryServiceConfig SUCCESS\r\n\r\nSERVICE_NAME: wwansvc\r\n        TYPE               : 20  WIN32_SHARE_PROCESS\r\n        START_TYPE         : 3   DEMAND_START\r\n        ERROR_CONTROL      : 1   NORMAL\r\n        BINARY_PATH_NAME   : C:\\Windows\\system32\\svchost.exe -k LocalServiceNoNetwork\r\n        LOAD_ORDER_GROUP   : TDI\r\n        TAG                : 0\r\n        DISPLAY_NAME       : WWAN AutoConfig\r\n        DEPENDENCIES       : PlugPlay\r\n                           : RpcSs\r\n                           : NdisUio\r\n                           : NlaSvc\r\n        SERVICE_START_NAME : NT Authority\\LocalService\r\n<\/pre>\n<h4>2.1.1b. SC &#8220;Stop&#8221; and &#8220;Start&#8221;<\/h4>\n<p>The most common thing I use SC for is to stop and start services (like restarting the print spooler service for example).  Piggybacking off my spooler reference there, here&#8217;s an example (with output) of restarting the print spooler service (its <em>service name<\/em> is simply &#8220;spooler&#8221;):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc stop spooler\r\n\r\nSERVICE_NAME: spooler\r\n        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)\r\n        STATE              : 3  STOP_PENDING\r\n                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x3\r\n        WAIT_HINT          : 0x4e20\r\n<\/pre>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc start spooler\r\n\r\nSERVICE_NAME: spooler\r\n        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)\r\n        STATE              : 2  START_PENDING\r\n                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x7d0\r\n        PID                : 51156\r\n        FLAGS              :\r\n<\/pre>\n<p>If you&#8217;d like to concatenate the commands, you can do it like this:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc stop spooler &amp; sc start spooler\r\n<\/pre>\n<p>Remember that you can use these functions to control remote services as well, like this:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\&lt;computername&gt; stop spooler\r\n<\/pre>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\&lt;computername&gt; start spooler\r\n<\/pre>\n<p>(or concatenated)<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\&lt;computername&gt; stop spooler &amp; sc \\\\&lt;computername&gt; start spooler\r\n<\/pre>\n<p>Sometimes you may want to script this process, and you may need to incorporate a timeout (which is essentially a timed pause) to prevent your commands from &#8220;jumping the gun&#8221; so to speak.  Here&#8217;s an example of using a batch script to restart a service (with a 15 second timeout after sending the stop command, and a 5 second timeout after sending the start command):<\/p>\n<pre class=\"brush:plain; highlight:[1,2,3,4,5,6]\">\r\n@echo off\r\nsc stop &lt;service_name&gt;\r\nTIMEOUT \/T 15\r\nsc start &lt;service_name&gt;\r\nTIMEOUT \/T 5\r\nexit\r\n<\/pre>\n<p>Using timeouts can be very handy when you need to give services time to gracefully stop or start.<\/p>\n<h4>2.1.1c. SC &#8220;Config&#8221;<\/h4>\n<p>The <code>config<\/code> command, when used with SC, will enable you to persistently change the configuration of a service (for example, to set a service to start automatically).<\/p>\n<p>You may have no use for the &#8220;Windows Media Player Network Sharing Service&#8221;, so you could set it to <em>disabled<\/em>&nbsp; by using the following command:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc config WMPNetworkSvc start= disabled\r\n\r\n(note: the space after \"start=\" is important!)\r\n<\/pre>\n<p>If you want a service to always start automatically, you would simply choose <em>auto<\/em>&nbsp; instead of <em>disabled<\/em>.  Here&#8217;s an example of configuring the Remote Registry service to start automatically:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc config RemoteRegistry start= auto\r\n<\/pre>\n<h4>2.1.1d. SC &#8220;Delete&#8221;<\/h4>\n<p>There likely won&#8217;t be many instances where you&#8217;ll need to delete a service, but this is still a helpful command to know.  The most common thing I use it for is to delete the PsExec service from a remote machine when it gets &#8220;stuck&#8221;.  <\/p>\n<p><strong>NOTE:<\/strong>&nbsp; The above info is important to be aware of because there are times when you&#8217;ll attempt to connect with PsExec to a remote machine and you&#8217;ll get a message like this:<\/p>\n<pre class=\"brush:plain; highlight:[1,2]\">\r\nError establishing communication with PsExec service on site1-pc1:\r\nThe system cannot find the file specified.\r\n<\/pre>\n<p>This message occurs because the PsExec service already exists <em>and<\/em>&nbsp; is running on the remote machine.  A <code>stop<\/code> command usually fixes this:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\site1-pc1 stop psexesvc\r\n<\/pre>\n<p>But there are other times when the service exists, but it&#8217;s <em>not<\/em>&nbsp; running, and in those cases you&#8217;ll need to delete the service, like this:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\site1-pc1 delete psexesvc\r\n\r\n(note: the missing \"c\" in \"psexesvc\" is not a typo; that's the exact service name for the PsExec service)\r\n<\/pre>\n<h4><em>(2.1.1. Surprise Bonus! SC &quot;Create&quot;)<\/em><\/h4>\n<p>The <em>create<\/em>&nbsp; option basically enables you to register an application as a service!  &#8220;Why would I want to do that?&#8221;, you ask?  Consider this scenario:<\/p>\n<p>You have a webcam connected to your computer, and you have it configured while you&#8217;re away to start recording video if it detects movement.  However, one of the caveats is that the camera app needs to be running.  But you say &#8220;Why is that a big deal!? I can start the app and let it run while I&#8217;m away!&#8221;.  Well, what if while you&#8217;re away, your computer has one of those rare times where it reboots for no reason?  Or what if you forget to start the app before you leave?  Then your camera app won&#8217;t be running, so it won&#8217;t be able to record video.  But if you register the camera app as a service, it&#8217;ll be running as soon as Windows is running (whether you&#8217;re logged on or not!).<\/p>\n<p>So here&#8217;s how you would register that app as a service: Let&#8217;s say your app is called &#8220;Camera App&#8221; and it&#8217;s located in <code>C:\\!Central\\Apps\\Camera App\\<\/code> and the name of the app is <em>camera_app.exe<\/em>.  Here&#8217;s how you would create a service from this app:<\/p>\n<p>First let me show you the syntax for creating a service with SC:<\/p>\n<pre class=\"brush:plain\">\r\nUSAGE:\r\n        sc  create [service name] [binPath= ]  ...\r\n\r\nOPTIONS:\r\nNOTE: The option name includes the equal sign.\r\n      A space is required between the equal sign and the value.\r\n type= \r\n       (default = own)\r\n start= \r\n       (default = demand)\r\n error= \r\n       (default = normal)\r\n binPath= \r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n       (default = LocalSystem)\r\n DisplayName= \r\n password= \r\n<\/pre>\n<p>OK, so here&#8217;s the command to create a service from our &#8220;Camera App&#8221; example:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc create camera displayname= \"Camera App\" binpath= \"C:\\!Central\\Apps\\Camera_App\\camera_app.exe\" start= auto\r\n[SC] CreateService SUCCESS\r\n<\/pre>\n<p>Pretty cool stuff, eh!? : )<\/p>\n<h4>2.1.2. NET<\/h4>\n<p>Net can be used to perform a variety of functions (not just controlling services).  For this particular guide, I&#8217;ll only be covering a couple of examples as they relate to controlling services.<\/p>\n<p>The native help for NET (specifically with regards to services) is as follows:<\/p>\n<pre class=\"brush:plain\">\r\nSyntax\r\n      NET START [service]\r\n      NET STOP [service]\r\n      NET PAUSE [service]\r\n      NET CONTINUE [service] \r\nKey\r\n   service : The service name as shown in Control Panel, Services\r\n<\/pre>\n<p><strong>NOTE 1:<\/strong>&nbsp; As you can see in the syntax above, there&#8217;s an option to pause or continue a service.  I&#8217;ve personally never used these functions, so I won&#8217;t be covering examples for them in this guide.  You at least know about them if you decide you&#8217;d like to utilize those functions.<\/p>\n<p><strong>NOTE 2:<\/strong>&nbsp; It&#8217;s actually possible to use the NET command to verify if a service is running, but it&#8217;s a little more cumbersome compared to using SC, so I won&#8217;t be covering that info in this guide either.<\/p>\n<p>Here&#8217;s an example of restarting the print spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nnet stop spooler\r\nThe Print Spooler service is stopping.\r\nThe Print Spooler service was stopped successfully.\r\n<\/pre>\n<pre class=\"brush:plain; highlight:[1]\">\r\nnet start spooler\r\nThe Print Spooler service is starting.\r\nThe Print Spooler service was started successfully.\r\n<\/pre>\n<h4>2.1.3. WMIC<\/h4>\n<p>I personally can&#8217;t think of any instances where WMI would be the best option to stop or start a service (because something like SC is more efficient), but I&#8217;ll at least provide the basics of how to use it to stop and start services.<\/p>\n<p>Here&#8217;s an example of stopping the print spooler service (line 1 is the command, and lines 2-8 are the output):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic service where \"name = 'spooler'\" call stopservice\r\nExecuting (\\\\IT-SHUEY-PC1\\ROOT\\CIMV2:Win32_Service.Name=\"Spooler\")-&gt;stopservice()\r\nMethod execution successful.\r\nOut Parameters:\r\ninstance of __PARAMETERS\r\n{\r\n        ReturnValue = 0;\r\n};\r\n<\/pre>\n<p>And here&#8217;s the command to verify that the service stopped (line 1 is the command, and lines 2-3 are the output):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic service where \"name = 'spooler'\" get started\r\nStarted\r\nFALSE\r\n<\/pre>\n<p>Here&#8217;s an example of starting the print spooler service, and then verifying that it&#8217;s started:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic service where \"name = 'spooler'\" call startservice\r\nExecuting (\\\\IT-SHUEY-PC1\\ROOT\\CIMV2:Win32_Service.Name=\"Spooler\")-&gt;startservice()\r\nMethod execution successful.\r\nOut Parameters:\r\ninstance of __PARAMETERS\r\n{\r\n        ReturnValue = 0;\r\n};\r\n<\/pre>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic service where \"name = 'spooler'\" get started\r\nStarted\r\nTRUE\r\n<\/pre>\n<p>Here&#8217;s an example of using WMI to verify the state of the spooler service on a remote machine (&#8220;SITE1-PC1&#8221; is the name of the remote station in my example):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic \/node:\"SITE-PC1\" service where caption='print spooler' get state\r\nState\r\nRunning\r\n<\/pre>\n<p>Here&#8217;s an even shorter example using <code>where name<\/code> (instead of <code>where caption<\/code>) which allows using the service name instead of the full name (<code>spooler<\/code> instead of <code>print spooler<\/code>):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic \/node:\"SITE-PC1\" service where name='spooler' get state\r\nState\r\nRunning\r\n<\/pre>\n<h4><em>(2.1.3. Surprise Bonus! Alternate WMI Commands)<\/em><\/h4>\n<p>There&#8217;s a lot of cool stuff you can do with WMI, beyond just controlling services.  Here&#8217;s a couple of examples:<\/p>\n<p>Verifying the BIOS version of a remote computer:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic \/node:\"site1-pc1\" bios get smbiosbiosversion\r\nSMBIOSBIOSVersion\r\nK01 v03.04\r\n<\/pre>\n<p>Verifying the serial number of a remote computer:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwmic \/node:\"site1-pc1\" systemenclosure get serialnumber\r\nSerialNumber\r\nZX583PP1\r\n<\/pre>\n<h4>2.1.4. PowerShell<\/h4>\n<p>As I said before, I personally have found that SC is more effective for managing services, but PowerShell is still preferred by some people for various reasons.  I&#8217;ll provide some brief info and examples of how PowerShell can be used to manage services.<\/p>\n<p>To see which cmdlets are available for the use of managing services, type:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nget-command -noun service\r\n<\/pre>\n<p>Notice the output:<\/p>\n<pre class=\"brush:plain\">\r\nCommandType     Name                    Definition\r\n------\t\t---------------\t\t--------------------------------------------------------\r\nCmdlet\t\tGet-Service\t\t    Get-Service [[-Name] ] [-ComputerName &lt;String[...\r\nCmdlet\t\tNew-Service\t\t    New-Service [-Name]  [-BinaryPathName]  ...\r\nCmdlet\t\tRestart-Service\t\tRestart-Service [-Name]  [-Force] [-PassThru] ...\r\nCmdlet\t\tResume-Service\t\tResume-Service [-Name]  [-PassThru] [-Include ...\r\nCmdlet\t\tSet-Service\t\t    Set-Service [-Name]  [-ComputerName ] ...\r\nCmdlet\t\tStart-Service\t\tStart-Service [-Name]  [-PassThru] [-Include &lt;...\r\nCmdlet\t\tStop-Service\t\tStop-Service [-Name]  [-Force] [-PassThru] [-I...\r\nCmdlet\t\tSuspend-Service\t\tSuspend-Service [-Name]  [-PassThru] [-Include...\r\n<\/pre>\n<p>Notice that PowerShell has a <code>Restart-Service<\/code> cmdlet, which combines the stop and start functionality into one cmdlet.  You of course still have the option of using <code>Stop-Service<\/code> and <code>Start-Service<\/code> separately one-at-a-time.<\/p>\n<p>If you&#8217;d like help for a particular cmdlet, type:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nget-help &lt;cmdlet_name&gt;\r\n<\/pre>\n<p>Here&#8217;s an example of getting help for the <code>Get-Service<\/code> cmdlet:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nget-help get-service\r\n\r\nNAME\r\n    Get-Service\r\n\r\nSYNOPSIS\r\n    Gets the services on a local or remote computer.\r\n\r\nSYNTAX\r\n    Get-Service [[-Name] ] [-ComputerName ] [-DependentServices] [-Exclude ] [-Include ] [-RequiredServices] []\r\n    \r\n    Get-Service -DisplayName  [-ComputerName ] [-DependentServices] [-Exclude ] [-Include ] [-RequiredServices] []\r\n    \r\n    Get-Service [-InputObject ] [-ComputerName ] [-DependentServices] [-Exclude ] [-Include ] [-RequiredServices] []\r\n\r\nDESCRIPTION\r\n    The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running and stopped services. \r\n\r\n    You can direct Get-Service to get only particular services by specifying the service name or display name of the services, or you can pipe service objects to Get-Service.\r\n\r\nRELATED LINKS\r\n    Online version: http:\/\/go.microsoft.com\/fwlink\/?LinkID=113332\r\n    Start-Service \r\n    Stop-Service \r\n    Restart-Service \r\n    Resume-Service \r\n    Suspend-Service \r\n    Set-Service \r\n    New-Service \r\n\r\nREMARKS\r\n    To see the examples, type: \"get-help Get-Service -examples\".\r\n    For more information, type: \"get-help Get-Service -detailed\".\r\n    For technical information, type: \"get-help Get-Service -full\".\r\n<\/pre>\n<p>Now I&#8217;ll show you an example of what happens when you try to use PowerShell to perform a task as simple as restarting a service.  First I&#8217;ll show you the syntax for the <code>Restart-Service<\/code> cmdlet:<\/p>\n<pre class=\"brush:plain\">\r\nSYNTAX\r\n    Restart-Service [-Name]  [-Exclude ] [-Force] [-Include ] [-PassThru] [-Confirm] [-WhatIf] []\r\n\r\n    Restart-Service -DisplayName  [-Exclude ] [-Force] [-Include ] [-PassThru] [-Confirm] [-WhatIf] []\r\n\r\n    Restart-Service [-InputObject ] [-Exclude ] [-Force] [-Include ] [-PassThru] [-Confirm] [-WhatIf] []\r\n<\/pre>\n<p>OK, so, based on the syntax example, I would think that this would be fairly easy.  But it&#8217;s not as easy as you would think.  Here&#8217;s an example of what happens when I try to restart the spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nrestart-service spooler\r\n\r\nRestart-Service : Cannot stop service 'Print Spooler (spooler)' because it has dependent services. It can only be stopped if the Force flag is set.\r\nAt line:1 char:16\r\n+ restart-service &lt;&lt;&lt;&lt;  spooler\r\n    + CategoryInfo          : InvalidOperation: (System.ServiceProcess.ServiceController:ServiceController) [Restart-Service], ServiceCommandException\r\n    + FullyQualifiedErrorId : ServiceHasDependentServices,Microsoft.PowerShell.Commands.RestartServiceCommand\r\n<\/pre>\n<p>OK, so it looks like I need to use the <code>-Force<\/code> flag to get this to work, so here&#8217;s an example of what happens when I try using the <code>-Force<\/code> flag:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nrestart-service spooler -Force\r\n\r\nWARNING: Waiting for service 'Print Spooler (spooler)' to finish starting...\r\n<\/pre>\n<p>Checking the service with the <code>Get-Service<\/code> command reveals that the restart of the service was successful:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nget-service spooler\r\n\r\nStatus   Name               DisplayName                           \r\n------   ----               -----------                           \r\nRunning  spooler            Print Spooler \r\n<\/pre>\n<p>There&#8217;s a ton of other commands and things you can do with PowerShell, but that&#8217;s outside the scope of this guide.<\/p>\n<h3><em>(2.2. Third-Party and\/or Non-Native Tools)<\/em><\/h3>\n<h4>2.2.1. PsService<\/h4>\n<p>This tool is similar to SC, but it produces slightly different results.<\/p>\n<p><strong>NOTE:<\/strong>&nbsp; Something interesting about the PsService tool (and slightly odd in my opinion) is that there is no option to delete a service&#8230;<\/p>\n<p>Here&#8217;s the syntax for PsService:<\/p>\n<pre class=\"brush:plain\">\r\nUsage: psservice [\\\\Computer [-u Username [-p Password]]]  \r\nCmd is one of the following:\r\n   query      Queries the status of a service\r\n   config     Queries the configuration\r\n   setconfig  Sets the configuration\r\n   start      Starts a service\r\n   stop       Stops a service\r\n   restart    Stops and then restarts a service\r\n   pause      Pauses a service\r\n   cont       Continues a paused service\r\n   depend     Enumerates the services that depend on the one specified\r\n   find       Searches for an instance of a service on the network\r\n   security   Reports the security permissions assigned to a service\r\n\r\nUse the username and password to log into the remote computer in cases where your account does not have permissions to perform the action you specify.\r\n\r\nOmitting a command queries the active services on the specified computer.\r\nEnter -? for help on a particular command.\r\n<\/pre>\n<p>Here&#8217;s an example of the info that PsService produces (querying the <em>remoteregistry<\/em>&nbsp; service for example):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice \\\\site1-pc1 query remoteregistry\r\n\r\nSERVICE_NAME: RemoteRegistry\r\nDISPLAY_NAME: Remote Registry\r\nEnables remote users to modify registry settings on this computer. If this service is stopped, the registry can be modified only by users on this computer. If this service is disabled, any services that explicitly depend on it will fail to start.\r\n        TYPE              : 20 WIN32_SHARE_PROCESS\r\n        STATE             : 4  RUNNING\r\n                               (STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE   : 0  (0x0)\r\n        SERVICE_EXIT_CODE : 0  (0x0)\r\n        CHECKPOINT        : 0x0\r\n        WAIT_HINT         : 0 ms\r\n<\/pre>\n<p>Here&#8217;s an example of restarting the print spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice restart spooler\r\n\r\nSERVICE_NAME: spooler\r\nDISPLAY_NAME: Print Spooler\r\nLoads files to memory for later printing\r\n        GROUP             : SpoolerGroup\r\n        TYPE              : 110 WIN32_OWN_PROCESS INTERACTIVE_PROCESS\r\n        STATE             : 2  START_PENDING\r\n                               (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE   : 0  (0x0)\r\n        SERVICE_EXIT_CODE : 0  (0x0)\r\n        CHECKPOINT        : 0x0\r\n        WAIT_HINT         : 2000 ms\r\n<\/pre>\n<p>Here&#8217;s an example of querying the print spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice query spooler\r\n\r\nSERVICE_NAME: Spooler\r\nDISPLAY_NAME: Print Spooler\r\nLoads files to memory for later printing\r\n        GROUP             : SpoolerGroup\r\n        TYPE              : 110 WIN32_OWN_PROCESS INTERACTIVE_PROCESS\r\n        STATE             : 4  RUNNING\r\n                               (STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE   : 0  (0x0)\r\n        SERVICE_EXIT_CODE : 0  (0x0)\r\n        CHECKPOINT        : 0x0\r\n        WAIT_HINT         : 0 ms\r\n<\/pre>\n<p>Remember how SC can show configuration info  with <em>qc<\/em>&nbsp;?  With PsService, it&#8217;s done using the <code>config<\/code> command.  Here&#8217;s an example with the spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice config spooler\r\n\r\nSERVICE_NAME: Spooler\r\nDISPLAY_NAME: Print Spooler\r\nLoads files to memory for later printing\r\n        TYPE              : 110 WIN32_OWN_PROCESS INTERACTIVE_PROCESS\r\n        START_TYPE        : 2  AUTO_START\r\n        ERROR_CONTROL     : 1  NORMAL\r\n        BINARY_PATH_NAME  : C:\\Windows\\System32\\spoolsv.exe\r\n        LOAD_ORDER_GROUP  : SpoolerGroup\r\n        TAG               : 0\r\n        DEPENDENCIES      : RPCSS\r\n                          : http\r\n        SERVICE_START_NAME: LocalSystem\r\n        FAIL_RESET_PERIOD : 86400 seconds\r\n        FAILURE_ACTIONS   : Restart     DELAY: 60000 seconds\r\n                          : Restart     DELAY: 60000 seconds\r\n                          : None        DELAY: 0 seconds\r\n<\/pre>\n<p>Here&#8217;s an example of setting the WMPNetworkSvc to <em>disabled<\/em>&nbsp;:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice setconfig wmpnetworksvc disabled\r\n\r\nStart type of wmpnetworksvc on \\\\SITE1-PC1 set to disabled.\r\n<\/pre>\n<p>And as I mentioned back in the beginning of section 2, PsService can also be used to input credentials on remote machines!  Here&#8217;s an example of restarting the spooler service on a remote machine, using the appropriate credentials:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsservice \\\\site1-pc1 -u admin -p P@ssw0rd restart spooler\r\n\r\nSERVICE_NAME: spooler\r\nDISPLAY_NAME: Print Spooler\r\nLoads files to memory for later printing\r\n        GROUP             : SpoolerGroup\r\n        TYPE              : 110 WIN32_OWN_PROCESS INTERACTIVE_PROCESS\r\n        STATE             : 2  START_PENDING\r\n                               (NOT_STOPPABLE,NOT_PAUSABLE,IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE   : 0  (0x0)\r\n        SERVICE_EXIT_CODE : 0  (0x0)\r\n        CHECKPOINT        : 0x2\r\n        WAIT_HINT         : 20000 ms\r\n<\/pre>\n<h4>2.2.2. RemoteService<\/h4>\n<p>This is a cool little free utility from <strong><em><a href=\"http:\/\/www.intelliadmin.com\/index.php\/author\/steve-wiseman\/\" target=\"_blank\">Steve Wiseman<\/a><\/em><\/strong> &nbsp;of IntelliAdmin!  One of the biggest benefits of this tool is that, like PsService, it can be used to input credentials against remote machines.  However, it&#8217;s a little more limited than PsService, in terms of command actions (it only allows you to <em>stop<\/em>&nbsp; or <em>start<\/em>&nbsp; a service)<\/p>\n<p>Here&#8217;s the usage:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nremoteservice \/?\r\n*************************************************************************\r\n* IntelliAdmin Remote Service                                           *\r\n* Stop or start services - remotely                                     *\r\n* Usage:                                                                *\r\n* RemoteService.exe    [USERNAME] [PASSWORD]                            *\r\n* Possible Actions: STOP, START                                         *\r\n* Username and password are optional values                             *\r\n* ----------------------------------------------------------------------*\r\n* More Free Utilities at: http:\/\/www.intelliadmin.com                   *\r\n*************************************************************************\r\n<\/pre>\n<p>And here&#8217;s a syntax example:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nremoteservice.exe &lt;remote_computer_name_or_ip&gt; &lt;action&gt; &lt;service_name&gt; &lt;username&gt; &lt;password&gt;\r\n<\/pre>\n<p>Here&#8217;s an example of stopping the spooler service:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nremoteservice.exe site1-pc1 stop spooler admin P@ssw0rd\r\n\r\n-Authenticating with \\\\site-pc1\r\n-Authentication complete\r\n-Stopping service\r\n-Service stopped\r\n<\/pre>\n<h3><em>(2.3. Bonus: Extra Tools &amp; Tips)<\/em><\/h3>\n<h4>2.3.1. PsExec<\/h4>\n<p>PsExec is one of my best friends when it comes to remote management!  It&#8217;s one of those tools that <strong><em>can<\/em><\/strong> &nbsp;be used to manage services, but the likelihood of using it for that is slim to none (but I couldn&#8217;t resist including it in this guide, because of how powerful it is!).  Let&#8217;s look at some of the cool things you can do with it!<\/p>\n<p>First let&#8217;s look at the syntax:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \/?\r\n\r\nPsExec executes a program on a remote system, where remotely executed console applications execute interactively.\r\n\r\nUsage: psexec [\\\\computer[,computer2[,...] | @file]][-u user [-p psswd][-n s][-r servicename][-h][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-\r\nw directory][-d][-][-a n,n,...] cmd [arguments]\r\n     -a         Separate processors on which the application can run with\r\n                commas where 1 is the lowest numbered CPU. For example,\r\n                to run the application on CPU 2 and CPU 4, enter:\r\n                \"-a 2,4\"\r\n     -c         Copy the specified program to the remote system for\r\n                execution. If you omit this option the application\r\n                must be in the system path on the remote system.\r\n     -d         Don't wait for process to terminate (non-interactive).\r\n     -e         Does not load the specified account's profile.\r\n     -f         Copy the specified program even if the file already\r\n                exists on the remote system.\r\n     -i         Run the program so that it interacts with the desktop of the\r\n                specified session on the remote system. If no session is\r\n                specified the process runs in the console session.\r\n     -h         If the target system is Vista or higher, has the process\r\n                run with the account's elevated token, if available.\r\n     -l         Run process as limited user (strips the Administrators group\r\n                and allows only privileges assigned to the Users group).\r\n                On Windows Vista the process runs with Low Integrity.\r\n     -n         Specifies timeout in seconds connecting to remote computers.\r\n     -p         Specifies optional password for user name. If you omit this\r\n                you will be prompted to enter a hidden password.\r\n     -r         Specifies the name of the remote service to create or interact.\r\n                with.\r\n     -s         Run the remote process in the System account.\r\n     -u         Specifies optional user name for login to remote\r\n                computer.\r\n     -v         Copy the specified file only if it has a higher version number\r\n                or is newer on than the one on the remote system.\r\n     -w         Set the working directory of the process (relative to\r\n                remote computer).\r\n     -x         Display the UI on the Winlogon secure desktop (local system\r\n                only).\r\n     -arm       Specifies the remote computer is of ARM architecture.\r\n     -priority  Specifies -low, -belownormal, -abovenormal, -high or\r\n                -realtime to run the process at a different priority. Use\r\n                -background to run at low memory and I\/O priority on Vista.\r\n     computer   Direct PsExec to run the application on the remote\r\n                computer or computers specified. If you omit the computer\r\n                name PsExec runs the application on the local system,\r\n                and if you specify a wildcard (\\\\*), PsExec runs the\r\n                command on all computers in the current domain.\r\n     @file      PsExec will execute the command on each of the computers listed\r\n                in the file.\r\n     cmd            Name of application to execute.\r\n     arguments  Arguments to pass (note that file paths must be\r\n                absolute paths on the target system).\r\n     -accepteula This flag suppresses the display of the license dialog.\r\n     -nobanner   Do not display the startup banner and copyright message.\r\n\r\nYou can enclose applications that have spaces in their name with quotation marks e.g. psexec \\\\marklap \"c:\\long name app.exe\". Input is only passed to the remote system when you press the enter key, and typing Ctrl-C terminates the remote process.\r\n\r\nIf you omit a user name the process will run in the context of your account on the remote system, but will not have access to network resources (because it is impersonating). Specify a valid user name in the Domain\\User syntax if the remote process requires access to network resources or to run in a different account. Note that the password and command is encrypted in transit to the remote system.\r\n\r\nError codes returned by PsExec are specific to the applications you execute, not PsExec.\r\n<\/pre>\n<p>Now let&#8217;s look at one of my favorite things you can do with PsExec &#8211;&gt; launch a remote command prompt!<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \\\\site1-pc1 -s cmd\r\n<\/pre>\n<p>The first time you type that, it may not look like anything happened, but if you look at the title bar of your command prompt window, it should indicate that you&#8217;re connected to the remote machine (<code>\\\\site1-pc1: cmd<\/code> in my example).  You can double-check by typing <code>hostname<\/code> and verifying the output:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nhostname\r\nSITE1-PC1\r\n<\/pre>\n<p>OK, so what&#8217;s so cool about being connected to a remote command prompt?  Well, you can run a lot of the same commands that you would run if you were actually physically sitting at the remote computer!  An example of where this can be powerful is if you need to run commands that are more challenging to run otherwise (like if you were going to run a bunch of <code>netsh advfirewall<\/code> commands; it&#8217;s nice to be able to connect to the remote machine and then run everything from there once you&#8217;re connected).<\/p>\n<p>Alright, so to maintain officiality, let me show you an example of managing a service.  Here&#8217;s an example of stopping and starting the print spooler service on SITE1-PC1:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \\\\site1-pc1 -s cmd \/c \"sc stop spooler\"\r\n\r\nSERVICE_NAME: spooler\r\n        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)\r\n        STATE              : 3  STOP_PENDING\r\n                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x3\r\n        WAIT_HINT          : 0x4e20\r\ncmd exited on site1-pc1 with error code 0.\r\n<\/pre>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \\\\site1-pc1 -s cmd \/c \"sc start spooler\"\r\n\r\nSERVICE_NAME: spooler\r\n        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)\r\n        STATE              : 2  START_PENDING\r\n                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x7d0\r\n        PID                : 1056\r\n        FLAGS              :\r\ncmd exited on site1-pc1 with error code 0.\r\n<\/pre>\n<p><strong>NOTE:<\/strong>&nbsp; The <code>\/c<\/code> after <code>cmd<\/code> tells the shell to run the command and then terminate.  I like to think of it like this: you&#8217;re essentially telling the shell, &#8220;Hey, go over there and run that command, then come back here to me&#8221;.  If you wanted the shell to run the command and wait at the remote computer for more instructions, you would use a <code>\/k<\/code> instead of <code>\/c<\/code>.<\/p>\n<p>There&#8217;s <strong>a lot<\/strong> more you can do with PsExec, but that would require a separate dedicated guide.<\/p>\n<h4>2.3.2. WinRS<\/h4>\n<p>This is another one of those built-in tools in Windows that you can do a lot with (and not just in terms of managing services).  And as a matter of fact, I would say that you&#8217;ll likely never use WinRS to manage services, but it&#8217;s too cool of a utility to not mention it! Two things that I often use WinRS for are:<\/p>\n<ul>\n<li>To send Wake-On-LAN (WOL) commands to machines that are powered off<\/li>\n<li>To instruct workstations to check for Windows updates, and then report their status to our WSUS server<\/li>\n<\/ul>\n<p><strong>NOTE 1:<\/strong>&nbsp; Remember, just based on its name alone, WinRS is used to execute commands on &#8220;remote&#8221; machines.<\/p>\n<p><strong>NOTE 2:<\/strong>&nbsp; One very important thing to be aware of with regards to WinRS is that it requires WinRM.  Per Microsoft&#8217;s definition, &#8220;Windows Remote Management (WinRM) is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based, firewall-friendly protocol that allows hardware and operating systems, from different vendors, to interoperate.&#8221;  I&#8217;ll provide more info about WinRM in a moment.<\/p>\n<p>The chances of someone using WinRS to manage services is highly unlikely, but to stay in line with the purpose of this guide, here&#8217;s at least one example of how it can be used; stopping the print spooler on &#8220;SITE1-PC1&#8221;:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrs -r:site1-pc1 sc stop spooler\r\n\r\nSERVICE_NAME: spooler\r\n        TYPE               : 110  WIN32_OWN_PROCESS  (interactive)\r\n        STATE              : 3  STOP_PENDING\r\n                                (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x3\r\n        WAIT_HINT          : 0x4e20\r\n<\/pre>\n<p>OK, so as I stated earlier, WinRS depends on WinRM.  If WinRM is not running or not configured on the remote machine that you&#8217;re trying to manage, then you may see an error like this:<\/p>\n<pre class=\"brush:plain\">\r\nWinrs error:The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: \"winrm quickconfig\".\r\n<\/pre>\n<p>In an instance like that, the first thing you can do is start the service and then try to query it again once it&#8217;s running.  The easiest\/fastest way to start the service remotely is like this (using &#8220;SITE1-PC1&#8221; as the reference example):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nsc \\\\site1-pc1 start winrm\r\n<\/pre>\n<p>After that, you can try to remotely query the service to verify if it&#8217;s running.  Here&#8217;s the command:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrs -r:site1-pc1 sc query winrm\r\n<\/pre>\n<p>If the service is running, you should see something like this:<\/p>\n<pre class=\"brush:plain\">\r\nSERVICE_NAME: winrm\r\n        TYPE               : 20  WIN32_SHARE_PROCESS\r\n        STATE              : 4  RUNNING\r\n                                (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)\r\n        WIN32_EXIT_CODE    : 0  (0x0)\r\n        SERVICE_EXIT_CODE  : 0  (0x0)\r\n        CHECKPOINT         : 0x0\r\n        WAIT_HINT          : 0x0\r\n<\/pre>\n<p>If you&#8217;re still getting an error message, the next step would be to configure WinRM on the remote station.  WinRM can be configured from a variety of ways (with each method being handy in its own right):<\/p>\n<p>Locally via &#8220;Quick Configure&#8221; (from and admin cmd prompt):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrm qc\r\n<\/pre>\n<p>Or remotely via PsExec (again, via an admin cmd prompt):<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \\\\site1-pc1 -s winrm.cmd qc\r\n<\/pre>\n<p>Or via group policy (Create or edit a GPO with the following settings):<\/p>\n<pre class=\"brush:plain\">\r\nComputer Configuration\r\n  Policies\r\n    Administrative Templates\r\n      Windows Components Windows Remote Management (WinRM)\r\n        WinRM Service\r\n           Allow automatic configuration of listeners\r\n           Set this to \"Enabled\" and either specify specific addresses, or use \"*\" in both filters (IPv4 and IPv6)\r\n<\/pre>\n<h4><em>(2.3. Surprise WinRS Bonus Tip!)<\/em><\/h4>\n<p>You didn&#8217;t think I was gonna leave you hangin&#8217; with that little bit of WinRS info, did ya!?  No way, lol!  Remember the two main things that I said I use WinRS for?  Well I&#8217;m going to show you those commands so you don&#8217;t leave here with your glass half-full.  Let&#8217;s fill that thing to the brim!<\/p>\n<h4>Using WinRS to send WOL commands<\/h4>\n<p>There&#8217;s a few things you should be aware of when it comes to sending WOL commands:<\/p>\n<ul>\n<li>The PC that you&#8217;re sending the WOL command to must be capable of receiving &#8220;magic packets&#8221; (The PC needs to have WOL enabled in the BIOS)<\/li>\n<li>For the majority of company LANs, it&#8217;s not possible to send magic packets through routers (in general, you&#8217;re limited to sending them from within the same subnet)<\/li>\n<li>Sometimes the NIC adapter from within Windows also needs to be enabled to allow magic packets<\/li>\n<\/ul>\n<p>LANs can differ greatly from one company to the next, so I&#8217;m going to share how <em>I<\/em>&nbsp; send magic packets in our network.  And if your network is similar to ours, you&#8217;ll be able to easily duplicate the methods I&#8217;ll be showing you.  If not, the concept and tools will still be similar and you should have no problem adapting them to your environment.  First I&#8217;ll briefly explain how I send magic packets in our network, then I&#8217;ll provide more details about the tools\/techniques I use.<\/p>\n<p>We have multiple sites with different subnets at each site, and they&#8217;re all connected via fiber.  So whenever I want to send a magic packet to wake up a machine, I use another computer that&#8217;s on the same subnet as the computer that I want to wake up; this other computer acts as a &#8220;middle-man PC&#8221;.  The reason I do it this way, instead of sending the packet directly from my own subnet, is because it never fails using this method.  I do this using a free, portable app called <strong><a href=\"http:\/\/www.matcode.com\/wol.htm\" target=\"_blank\">MC-WOL<\/a><\/strong>.  In our network, I used <strong><a href=\"https:\/\/www.pdq.com\/pdq-deploy\/\" target=\"_blank\">PDQ Deploy<\/a><\/strong> to deploy the <code>mc-wol.exe<\/code> file to every computer in our LAN (My PDQ script copies the file to the <code>C:\\Windows\\System32<\/code> folder on each machine).<\/p>\n<p>In the past, before I knew about WinRS, I would first use PsExec to connect to an online PC that&#8217;s in the same subnet as the machine I wanted to wake up:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\npsexec \\\\middle-man-pc -s cmd\r\n<\/pre>\n<p>Then I&#8217;d send the magic packet:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nmc-wol AB:CD:EF:01:23:45\r\n\r\n(note: I just entered a generically formatted MAC address there as an example)\r\n<\/pre>\n<p>But now that I&#8217;m familiar with and use WinRS, I can use a single command:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrs -r:middle-man-pc mc-wol AB:CD:EF:01:23:45\r\n<\/pre>\n<p>And, as promised, here&#8217;s the WinRS tip relating to WSUS:<\/p>\n<h4>Using WinRS to instruct workstations to report-in with their WSUS server<\/h4>\n<p>If you personally have access to your company&#8217;s WSUS server, remote in and open up the Update Services GUI console so you can see the report status of the computer you&#8217;re wanting to update.  If you <em>don&#8217;t<\/em>&nbsp; have direct access to your WSUS server, have one of your WSUS admins verify the computer&#8217;s report status for you after you execute the commands.<\/p>\n<p>The first thing you need to do is instruct the remote computer to check for updates from the WSUS server:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrs -r:remote-pc wuauclt \/detectnow\r\n<\/pre>\n<p>Then you need to instruct the computer to report-in with the WSUS server:<\/p>\n<pre class=\"brush:plain; highlight:[1]\">\r\nwinrs -r:remote-pc wuauclt \/reportnow\r\n<\/pre>\n<p>You should now be able to see an updated time stamp under the &#8220;Last Status Report&#8221; column in the WSUS console on the server.<\/p>\n<p><strong>NOTE:<\/strong>&nbsp; (per Lawrence Garvin of WSUS online fame) A couple of very important points to keep in mind when using <code>\/detectnow<\/code> and <code>\/reportnow<\/code>:<\/p>\n<p>The <code>\/reportnow<\/code> function is only processed when:<\/p>\n<ul>\n<li>There are completed events to report to the WSUS server<\/li>\n<li>The WUAgent is IDLE<\/li>\n<\/ul>\n<p>The WUAgent always automatically executes a reporting event approximately 20 minutes after the completion of all other pending activities. The purpose of the <code>\/reportnow<\/code> parameter is to immediately expire that 20 minute delay. So, when executing a script with these two commands in immediate succession (or issuing them from the command line immediately following one another), the reality is that the <code>wuauclt \/reportnow<\/code> invocation actually does nothing at all.<\/p>\n<p>The proper way to use these two commands is to first launch the <code>wuauclt \/detectnow<\/code> task, and then WAIT for the completion of the detection event. Typically this could take a couple of minutes, but on a healthy, fully patched system, it may complete in a matter of seconds.<\/p>\n<p>Once the WUAgent is idle, then executing <code>wuauclt \/reportnow<\/code> will cause the call to the ReportingWebService to occur immediately, rather than waiting for the built-in 20 minute delay.<\/p>\n<h2><a name=\"step3\"><\/a>3. Summary<\/h2>\n<p>There&#8217;s definitely no shortage of options when it comes to managing Windows services from the CLI, and it&#8217;s nice that the primary ones are already built-in to the Windows operating system.  Not only that, but there are some great third-party tools available as well (some of the best of which were actually created by a Microsoft employee!).<\/p>\n<p>I hope this guide is not only helpful, but also gets you excited to dive deeper into the realm of managing services on Windows machines!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this short guide, I&#8217;ll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It should also go without saying that &#8220;services&#8221; are an integral part of pretty much all computer systems. You should also be aware that &#8220;services&#8221; are sometimes referred to as daemons &hellip;<\/p>\n","protected":false},"author":34,"featured_media":202,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[117,119,118,112,99,115,116,89],"class_list":["post-2698","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-windows","tag-cli","tag-command-line","tag-command-prompt","tag-management-console","tag-microsoft","tag-mmc","tag-services","tag-windows"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Managing Windows Services from CLI - System Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this short guide, I&#039;ll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Managing Windows Services from CLI - System Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this short guide, I&#039;ll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\" \/>\n<meta property=\"og:site_name\" content=\"System Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/systemcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/shueysworld\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-20T14:15:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"John Schuepbach\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@Shuey187\" \/>\n<meta name=\"twitter:site\" content=\"@systemcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Schuepbach\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"34 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\"},\"author\":{\"name\":\"John Schuepbach\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/ec6271f05abf6c36cbb395b7da52ecaf\"},\"headline\":\"Managing Windows Services from CLI\",\"datePublished\":\"2017-06-20T14:15:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\"},\"wordCount\":4159,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg\",\"keywords\":[\"cli\",\"command line\",\"command prompt\",\"management console\",\"microsoft\",\"mmc\",\"services\",\"windows\"],\"articleSection\":[\"Windows\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\",\"name\":\"Managing Windows Services from CLI - System Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg\",\"datePublished\":\"2017-06-20T14:15:57+00:00\",\"description\":\"In this short guide, I'll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It\",\"breadcrumb\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.systemcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows\",\"item\":\"https:\/\/www.systemcodegeeks.com\/category\/windows\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Managing Windows Services from CLI\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#website\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"name\":\"System Code Geeks\",\"description\":\"Operating System Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.systemcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/systemcodegeeks\",\"https:\/\/x.com\/systemcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/ec6271f05abf6c36cbb395b7da52ecaf\",\"name\":\"John Schuepbach\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/806c8b2a346bc5d36ffe33b2f64d784ef648e4a6871ecc17ca274d7f2fbe8bb2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/806c8b2a346bc5d36ffe33b2f64d784ef648e4a6871ecc17ca274d7f2fbe8bb2?s=96&d=mm&r=g\",\"caption\":\"John Schuepbach\"},\"description\":\"I've been tinkering with computers since 1984 and have been working professionally in the field of IT since 2005. I love learning about new technology and always enjoy figuring out how things work. People also say that I'm a freak about detail and organization - I take that as a compliment ;). I'm commonly known as \\\"Shuey\\\". I'm known for my passionate obsession of all things that interest me; particularly computers, video games (like Tetris), music, art, etc.\",\"sameAs\":[\"https:\/\/www.systemcodegeeks.com\",\"https:\/\/www.facebook.com\/shueysworld\",\"https:\/\/www.linkedin.com\/in\/john-schuepbach-8278013\",\"https:\/\/x.com\/Shuey187\",\"http:\/\/www.youtube.com\/user\/Shuey187\"],\"url\":\"https:\/\/www.systemcodegeeks.com\/author\/john-schuepbach\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Managing Windows Services from CLI - System Code Geeks - 2026","description":"In this short guide, I'll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/","og_locale":"en_US","og_type":"article","og_title":"Managing Windows Services from CLI - System Code Geeks - 2026","og_description":"In this short guide, I'll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It","og_url":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/","og_site_name":"System Code Geeks","article_publisher":"https:\/\/www.facebook.com\/systemcodegeeks","article_author":"https:\/\/www.facebook.com\/shueysworld","article_published_time":"2017-06-20T14:15:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg","type":"image\/jpeg"}],"author":"John Schuepbach","twitter_card":"summary_large_image","twitter_creator":"@Shuey187","twitter_site":"@systemcodegeeks","twitter_misc":{"Written by":"John Schuepbach","Est. reading time":"34 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#article","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/"},"author":{"name":"John Schuepbach","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/ec6271f05abf6c36cbb395b7da52ecaf"},"headline":"Managing Windows Services from CLI","datePublished":"2017-06-20T14:15:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/"},"wordCount":4159,"commentCount":1,"publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg","keywords":["cli","command line","command prompt","management console","microsoft","mmc","services","windows"],"articleSection":["Windows"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/","url":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/","name":"Managing Windows Services from CLI - System Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.systemcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage"},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage"},"thumbnailUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg","datePublished":"2017-06-20T14:15:57+00:00","description":"In this short guide, I'll be reviewing the necessary information for how to manage services from the command line on Windows workstations and servers. It","breadcrumb":{"@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#primaryimage","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2016\/01\/windows-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.systemcodegeeks.com\/windows\/managing-windows-services-cli\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.systemcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Windows","item":"https:\/\/www.systemcodegeeks.com\/category\/windows\/"},{"@type":"ListItem","position":3,"name":"Managing Windows Services from CLI"}]},{"@type":"WebSite","@id":"https:\/\/www.systemcodegeeks.com\/#website","url":"https:\/\/www.systemcodegeeks.com\/","name":"System Code Geeks","description":"Operating System Developers Resource Center","publisher":{"@id":"https:\/\/www.systemcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.systemcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.systemcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.systemcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.systemcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/systemcodegeeks","https:\/\/x.com\/systemcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/ec6271f05abf6c36cbb395b7da52ecaf","name":"John Schuepbach","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.systemcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/806c8b2a346bc5d36ffe33b2f64d784ef648e4a6871ecc17ca274d7f2fbe8bb2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/806c8b2a346bc5d36ffe33b2f64d784ef648e4a6871ecc17ca274d7f2fbe8bb2?s=96&d=mm&r=g","caption":"John Schuepbach"},"description":"I've been tinkering with computers since 1984 and have been working professionally in the field of IT since 2005. I love learning about new technology and always enjoy figuring out how things work. People also say that I'm a freak about detail and organization - I take that as a compliment ;). I'm commonly known as \"Shuey\". I'm known for my passionate obsession of all things that interest me; particularly computers, video games (like Tetris), music, art, etc.","sameAs":["https:\/\/www.systemcodegeeks.com","https:\/\/www.facebook.com\/shueysworld","https:\/\/www.linkedin.com\/in\/john-schuepbach-8278013","https:\/\/x.com\/Shuey187","http:\/\/www.youtube.com\/user\/Shuey187"],"url":"https:\/\/www.systemcodegeeks.com\/author\/john-schuepbach\/"}]}},"_links":{"self":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/2698","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/users\/34"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/comments?post=2698"}],"version-history":[{"count":0,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/posts\/2698\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media\/202"}],"wp:attachment":[{"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/media?parent=2698"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/categories?post=2698"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemcodegeeks.com\/wp-json\/wp\/v2\/tags?post=2698"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}