in reply to How to log on to windows server?

Typically the remote server is attached (automatically) with the account the service is running on its own machine.

Alternatively you can connect with a different account. A command line to do so would be

net use \\remote /user:<user> <password>

<user> is either a domain account (aka domain\account) or a local account (from the remote machine).

<password> (for <user>) is optional, if it is identical to the pw of the current account, the process runs under.

The issued "net use" must be the first command of your service that contacts the remote machine, because that first encounter fixes the credentials for the interaction.

Replies are listed 'Best First'.
Re^2: How to log on to windows server?
by noslenj123 (Scribe) on Feb 03, 2006 at 23:45 UTC
    Yeah, I was trying to use a module function but I may be stuck with using the command line. I'll need to figure out if it's even possible from a service that runs as a local_system_account. I'll post back my results....
      For running under SYSTEM, you need null sessions to attach to network resources. For a nice introdution and discussion of null sessions see this paper, also naming this restriction on page 5.
        ++ for the interesting link!

        Due to the lack of responses on this, I will tackle it using the "net use" method. I was just hoping for something nice like:

        if ( $nt->login($server,$name,$pass) ) { # do things $nt->logout(); } else { report("Failed logging in to $server: " . $nt->errmsg); }