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

Hi Monks,
Is there any module/scripts that exist which will allow me to connect to a windows machine over a LAN from a windows machine, using an IP address|computer name, username and password? I am trying to use Win32::TieRegistry to obtain information from a remote machine, but it appears as though I either can't get through a firewall or the target machine will not allow me access to retrieve the information I want. I don't really know how to handle this.
thanks for your time, Steve

Replies are listed 'Best First'.
Re: Remote access to windows machine
by jhourcle (Prior) on Mar 17, 2005 at 04:09 UTC
    Joe's guide to testing network connections:
    1. Figure out which port you're trying to connect to.
    2. Make sure the port's open (netstat in unix, I have no idea in windows)
    3. Connect to the port from the target machine on loopback
    4. Connect to the port, from the target machine, on the external ip
    5. Connect to the port from a remote machine, using the target machine's IP address
    6. Connect to the port from a remote machine, using the FQDN.
    7. Attempt to use whatever automated scripts, local to the target machine
    8. Attempt to use whatever automated script from the remote machine.

    Based on how far you get before failing, you can get some idea what might be wrong --

    1. (nothing should fail at this point)
    2. The daemon's not running, or whatever needs to be listening
    3. ditto, or it's not listening on loopback (not all do)
    4. It's not listening on the external IP
    5. it's firewalled off, or tcp wrapped, etc.
    6. DNS isn't set up correctly on the remote machine, or the FQDN isn't in DNS
    7. The script may be flawed, or misconfigured.
    8. Ditto, but on a different machine.

    Some protocols are trickier to pin down, especially if they result in the remote server connecting back to client (eg, FTP in active mode). I have no idea how TieRegistry works, so it may not have these sorts of issues.

      netstat comes with Windows too, at least with the Pro line of OSes. Syntax: netstat -a.
Re: Remote access to windows machine
by eyepopslikeamosquito (Archbishop) on Mar 17, 2005 at 12:27 UTC

    Make sure you are opening the registry read only (KEY_READ) ( the default is read-write). I did this a while back but don't have the example code handy right now. If you posted your code, someone might see something. Also, you are saying it fails but don't tell us what $! and/or $^E contains -- again posting your code will help.

    As for remote execution on remote Windows machines sysinternals have some tools to do that.

      Hi, my code is based quite heavily on the code provided here. The extra work I have done involves basically dumping this information into a database.
        Depending on what database you're trying to feed, you might want to check out cpan:DBI. That way you let someone else handle all the lowlevel communication stuff.