A little ditty I threw together for our server dudes.   It automates their checks of remote WinNT hosts' Tivoli services.

Update: (Thanks|++) to Tye and dws for helpful suggestions.

#!/usr/bin/perl -w use strict; my $netsvc = 'netsvc.exe'; my @services = ( 'TSM Client Acceptor', 'TSM Client Scheduler', 'TSM Remote Client Agent', ); my @hosts = ( '\\\\box1', '\\\\hostB', '\\\\serverIII', ); foreach my $host (@hosts) { print " $host\n"; foreach my $service (@services) { print "$service "; system ("$netsvc $host /query \"$service\"") == 0 and warn " +error $!"; } print "\n"; } ###################################################################### +## =head1 Name tsmstat.pl =head1 Description Check multiple Win32 servers for running services =head1 Requirements WinNT4 Resource Kit for "netsvc" command Run from Win32 host in same NT domain as target(s) or in domain trusted by target domain(s) =head1 Tested ActiveState Perl 5.22 on WinNT4.0 sp6a =head1 Usage tsmstat.pl<enter> =head1 Updated 2001-03-22 Initial working code =head1 ToDos Fix "tsmstat.pl > outfile". Dunno why it produces 0byte outfile. Simultaneously print output to console and outfile Usage would then be something like: services.pl outfile<enter> Move @hosts and @sevices to external config file Use Win32::Service instead of system() Give explicit path to netsvc.exe in "my $netsvc" Works on my test PC but not Dave's PC Figure out how to prefix $host with NT domain =head1 Author ybiC (for one of the server dudes) =head1 Credits Thanks to Tye and dws for helpful suggestions =cut

In reply to (code) Check for particular services running on remote WinNT host(s) by ybiC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.