ein script kann man unter windows z.B. folgendermaszen starten
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /usr/bin/perl
use warnings;
use strict;
use Win32::OLE;
use Win32::OLE::Variant;
my $server = shift(@ARGV) || '.';
$server =~ s|^[\\/]+||;
my $class = "WinMgmts:{impersonationLevel=impersonate}!//$server";
my $wmi = Win32::OLE->GetObject($class) or
die "Error: Couldn't connect to \\\\$server: " . Win32::OLE->LastError();
# get a Win32_Process class object
my $process = $wmi->Get("Win32_Process") or
die "Error: couldn't get the process list: " . Win32::OLE->LastError();
# create a BYREF variant so a COM object can modify its value and return it
my $pid = Variant(VT_I4 | VT_BYREF, 0);
if (0 == $process->Create(join(" ", @ARGV), undef, undef, $pid)) {
print "Process created with PID $pid\n";
} # if
else {
print "Error: couldn't create process.\n";
}