#gets services on a bunch of servers, lists there name, and their state # Usage: readservices.pl server1 server2 server3 ... use strict; use Win32::Service qw(StartService StopService GetStatus GetServices); my %statcodeHash = ('1' => 'stopped.','2' => 'start pending.','3' => 'stop pending.','4' => 'running.','5' => 'continue pending.','6' => 'pause pending.','7' => 'paused.'); my %serviceHash; my ($service,%statusHash,$server); foreach $server (@ARGV){ print "\n\n##### $server #####\n\n"; GetServices("$server",\%serviceHash) or next; foreach(sort keys %serviceHash){ print "$_: $serviceHash{$_}\t"; &getstatus($server,$_); } } sub getstatus{ GetStatus("$_[0]", "$_[1]", \%statusHash); print "$statcodeHash{$statusHash{\"CurrentState\"}} \n"; }