Greetings,

I'm trying to solve a problem I have with dynamically connecting from
one machine to another. I'm able to do this in most cases, but for
whatever reason, I'm having problems with one particular machine.

The requirement is to poll a series of machines from a single location
for various purposes: copying files, making sure that files are being
processed in a timely manner, etc. Most of the time this works fine,
but I'm adding a new machine to the list to be polled and it's not
working.

As another quirk, I am able to connect to this new machine with the
"NET USE" command, but not with my program tools.

The following is a command line listing of what I've been able to do
and not do.

========== COMMAND LINE LISTING BEGIN ==============

h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>REM * Connect to other machine with NET USE command
*
h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>NET USE I: \\192.168.140.52\e$ ------- /user:bchambers
The command completed successfully.


h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>REM * Disconnect from the other machine
*
h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>NET USE I: /delete
I: was deleted successfully.


h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>REM * Try to connect programmatically to other machine;
this fails *
h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>TestDynamicMapping TLHBBSDBSVR1
Pulling command line parameter
Testing database connection
Database connection test successful.
Getting drive letter to use in mapping.
Using drive letter: F:


Pulled Connection Information
CommName: TLHBBSDBSVR1
NetPath: \\192.168.140.52\e$
ConnMethd: 2
User Id: bchambers
Password: -------

Error mapping drive
Function: CONNECT
Message: Logon failure: unknown user name or bad password.

Values: Name: TLHBBSDBSVR1 Drv: F: Path: \\192.168.140.52\e$
Conn: 2 User: bchambers Pass: -------


h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>REM * Connect to another machine just to show it works
*
h:\sourceBAT>REM
************************************************** ***************
h:\sourceBAT>TestDynamicMapping YELLOWCOMM
Pulling command line parameter
Testing database connection
Database connection test successful.
Getting drive letter to use in mapping.
Using drive letter: F:


Pulled Connection Information
CommName: YELLOWCOMM
NetPath: \\yellowcom\c$
ConnMethd: 2
User Id: yellowcom
Password: -------

Drive successfully mapped
Drive successfully un-mapped

========== COMMAND LINE LISTING END ==============

I presume that the user id I'm using to connect to the new machine has
something about its properties that is preventing this logon from
occurring. But I have no idea what it could be.

The mapping is trying to go to a WIN2K machine with Service Pack 4.
The mapping to YELLOWCOM also goes to a WIN2K machine with Service Pack
4. So I presume that's not the problem.

I'm using the WNetAddConnection and WNetAddConnection2 API calls to
make the connection. For this particular connection I'm using the
WNetAddConnection2 call.

If anyone has any ideas, I would love to hear them. Again, this
programmatic connection process works on all the boxes except this new
one I'm trying to add.

TIA,

Paul