title: Perl service status codes from Win32::Service module GetStatus() call do not match that of Services.msc applet
body: <p>I have been trying to write a Perl script that would check the service status of Remote Servers. I am using the <a href="http://search.cpan.org/perldoc/Win32%3a%3aService" rel="nofollow">Win32::Service</a> module to accomplish my goal.</p>
  
  <p>I find that the for some services value returned by <code>Win32::Service::GetStatus</code> <code>CurrentStatus</code> is not exactly the same as observed from services.msc applet. </p>
  
  <p>Here is the piece of script I am using along with both outputs from script and <code>servics.msc</code>.</p>
  
  <pre><code>use Data::Dumper;
  use Win32;
  use Win32::Service;
  use strict;
  use warnings;
  
  my %statcodeHash = (     '1' =&gt; 'stopped.',
                       '2' =&gt; 'start pending.',
                       '3' =&gt; 'stop pending.',
                       '4' =&gt; 'running.',
                       '5' =&gt; 'continue pending.',
                       '6' =&gt; 'pause pending.',
                       '7' =&gt; 'paused.'            );
  
  
  my @serviceNames = qw(NNMAction RpcEptMapper smstsmgr SNMPTRAP);
  
  foreach my $serv (@serviceNames)
  {   my %status;
      my $ret = Win32::Service::GetStatus('nnmi.hclt.corp.hcl.in', $serv, \%status);
      if ($ret)
      {   print "success\t$statcodeHash{$status{CurrentState}}\t$serv\n";
      }
      else
      {       print Win32::FormatMessage(Win32::GetLastError()), "\n";
      }
  }
  </code></pre>
  
  <p><em>OUTPUT from Script</em></p>
  
  <pre><code>D:\AVI MEHENWAL\PERL\SCRIPTS\PROJECTS\Serve Management&gt;perl -w perl_RemoteServiceStatus.pl
  success stopped.        NNMAction
  success running.        RpcEptMapper
  success stopped.        smstsmgr
  success stopped.        SNMPTRAP
  </code></pre>
  
  <p><em>OUTPUT from Services.msc</em></p>
  
  <pre><code>Name       Descrition   Status   StartupType  LogOnAs
  NNMAction  bla bla bla  Started  Manual       LocalSystem
  </code></pre>
  
  <p>Can anyone suggest me what approach should I follow to achieve my goal, Is my method wrong or there is something I am missing from Perl module point of view?</p>