wahoowa has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to run an executable located on a remote Win2k server, for that server. I'm getting errors about the exe only being able to run on win2k machines. The machine I'm running the script from is a NT4 machine, but I need the exe to run on that remote server. I've mapped and tried 'chdir', etc. here's my last attempt.
system ("net use J\: \\\\$hostname\\c\$"); chdir 'j:\abc\agent\config'; my $ldconfig = 'j:\abc\agent\config\config.exe'; system ("$ldconfig");

Replies are listed 'Best First'.
Re: Running exe's remotely
by zakb (Pilgrim) on Jan 30, 2003 at 16:17 UTC

    All your combination of chdir's and system's is doing is running the executable from the network on your machine.

    You need to use something like telnet (Net::Telnet?) to log in to the remote machine and run the executable on that machine. Of course, you'll need a telnet server on the Win2k machine.

      I use a Workstation module I wrote myself. one of the subs returns a WMI handle...

      sub get_wmi {
              my $self = shift;
              my $name = $self->name or do { 
                      warn("Cannot return WMI handle for anonymous workstation.\n");
                      return 0; 
              use Win32::OLE ;
              my $wmi = Win32::OLE->GetObject( "winmgmts:{impersonationLevel=impersonate,(security)}//$name");
              if ($wmi) {
                    return $wmi;        
                    return 0;
      You should then be able to do $wmi->CreateProcess("your.exe") or whatever (see for details of WMI)...

      Or Google for "perl+WMI" - or visit

Re: Running exe's remotely
by MZSanford (Curate) on Jan 30, 2003 at 18:22 UTC
    If you have the NT Resource Kit, take a look at rcmd ... it runs commands on the remote machine.
    from the frivolous to the serious

      Very useful and easier than my WMI solution - doesn't use much Perl, though :-(

      rcmd was a good idea, but unfortunately it's not installed on the remote win2k server....any other ideas?
Re: Running exe's remotely
by HamNRye (Monk) on Jan 30, 2003 at 20:46 UTC

    There are also various 'rsh' implementations for the windows platform. That is what we use here.... is the one we personally use.


Re: Running exe's remotely
by pg (Canon) on Jan 31, 2003 at 04:03 UTC
    One more option. I use VNC, you can take a look at their web site: VNC
Re: Running exe's remotely
by Skeptic (Initiate) on Jan 31, 2003 at 19:54 UTC
    My vote is for Rcmd... its only a file, maybe two to copy. If you don't have the reskit just laying around then the PStools are the way to go. That's if you want to take care of biz in short order.