Use WMI (Windows Management Instrumentation).
This book has 2 pages on WMI details, and 4 sample programs:
Win32 Perl Scripting: The Administrator's Handbook
This book has 7 pages on WMI details, and 4 code snippets:
Perl for System Administration: Managing multi-platform environments with Perl
A WMI tutorial, SDK, and documentation are available for download from Microsoft.
Working skeleton code, derived (and bug-fixed) from both books:
#!/usr/bin/perl -W # WMI_for_monks.pl use warnings 'all'; use strict; use Win32::OLE('in'); my ($Machine, $pid_to_kill) = @ARGV; $Machine =~ s{^[\\/]{2,}}{}; my $CLASS = 'WinMgmts:{impersonationLevel=impersonate}!//' . $Machine; my $WMI = Win32::OLE->GetObject( $CLASS ) or die Win32::OLE->LastError(); foreach my $proc (in $WMI->InstancesOf('Win32_Process')){ next unless $proc->{ProcessId} == $pid_to_kill; printf "Killing:%7d\t%s\n", $proc->{ProcessId}, $proc->{Name}; $proc->Terminate(0); }
This command:
WMI_for_monks.pl COSMOS 952
produced this output:
Killing: 952 winbff32.exe
In reply to Re: How do i kill a process on a remote win32 machine
by Util
in thread How do i kill a process on a remote win32 machine
by cab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |