welcome to the monastery coding_new and welcome to the 'win32 hell' too...
In last decade i faced the same problem: administrering a win32 environement using Perl: even if i had not won i'm not defeated too..

Here some consideration. There are tools that permit something like remotecommand, i avoid them because they are never safe. Even if billion of known bugs in this decade told us 'risk of remote code execution..' i was never able to use them.

Winzoz force you to use his propietary tools to do such things. Is not that bad as you can imagine. For example i have many Perl programs parsing systems calls: it is not so elegant but tend to be very stable over the years.

So you better use something that natively support remote execution. Some time ago i used 'wmi' to do such thing: wmi seemed to be the revolutionary thing at redmond (as today happen to powershell).

Another viable option is having a Perl client server infrastructure, where the server ask in realtime to client info that you need. it is not so difficult to realize, but not so easy to maintain and upgrade.

Here my old example of quering remote disks usin wmi (probably plagirazed from other monk..):
use Win32::OLE('in'); use constant wbemFlagReturnImmediately => 0x10; use constant wbemFlagForwardOnly => 0x20; sub Logical_Disks { my $computer=shift; my %HoH = (); my $objWMIService = Win32::OLE->GetObject("winmgmts:\\\\$compu +ter\\root\\CIMV2") or die "WMI connection failed.\n"; my $colItems = $objWMIService->ExecQuery("SELECT * FROM Win32_ +LogicalDisk", "WQL", wbemFlagReturnImmediately | wbemFlagForwardOnly)||wa +rn $!; foreach my $objItem (in $colItems) { my @drivetype= ('Unknown', 'No RootDirectory', 'RemovableD +isk', 'LocalDisk', 'Network Drive', 'Compact Disc', 'RAM Disk'); #next if $objItem->{Name}->{'DriveType'} ne 'LocalDisk';#s +kip non logical disks $HoH{ $objItem->{Name} }{ 'DriveType' } =$drivetype[$objIt +em->{DriveType}] ; $HoH{ $objItem->{Name} }{ 'VolumeName' } = $objItem->{Volu +meName}; $HoH{ $objItem->{Name} }{ 'Size' } = $objItem->{Size}; $HoH{ $objItem->{Name} }{ 'FreeSpace' } = $objItem->{FreeS +pace}; } foreach my $key(keys %HoH){delete $HoH{$key} unless $HoH{$key}->{' +DriveType'} eq 'LocalDisk'} return \%HoH; }

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Running Perl on Remote Windows Server by Discipulus
in thread Running Perl on Remote Windows Server by coding_new

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.