Check out Win32 Perl Scripting: The Administrator's Handbook by Roth. There are loads of Admin script in there.

Also check his script repository for more admin scripts.

Update: I include a simple script that takes a command line parameter and searches for that in the process list and kills all instances found.. to test simply launch many notepad.exe processes.. then run the following script I.e. pkill.pl notepad

#! /usr/bin/perl use strict; use warnings; use Win32; use Win32::API; use Win32::Process; use Win32::OLE qw( in ); #Identify the Process that have been left +to kill use Win32::OLE::Variant; #Identify the Process that have been left +to kill my $app = $ARGV[0]; if ($app) { my $rc = 1; my $srv = "\\\\" . $ENV{'COMPUTERNAME'}; my $CLASS = "winmgmts:{impersonationLevel=impersonate}$srv\\Root\\ +cimv2"; my $WMI = Win32::OLE->GetObject( $CLASS ) || die; foreach my $Proc ( sort {lc $a->{Name} cmp lc $b->{Name}} in( $WMI +->InstancesOf( "Win32_Process" ) ) ) { my $regex1 = "($app)"; if ($Proc->{Name} =~ /$regex1/i) { print "INFORMATION - About to kill $Proc->{ProcessID} for +$app\n"; unless (Win32::Process::KillProcess($Proc->{ProcessID}, 0) +) { print "Could not kill $Proc->{ProcessID} for $app\n"; } } } } else { print "$0 <app name>\n"; print "<app name> = name and extension or (part therof I.e. note f +or notepad) of process to kill\n"; }
-----
Of all the things I've lost in my life, its my mind I miss the most.

In reply to Re: Kill process program?? by AcidHawk
in thread Kill process program?? by Chad_MacArthur

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.