Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Username problem

Status
Not open for further replies.

tedsmith

Programmer
Nov 23, 2000
1,762
0
0
AU
I thought I had the answer from previous posts but the problem is still there.
When trying to use VB6 to interrogate a database on a brand new or recently formatted remote computer (via network) I get a failure notice that says "you do not have permission etc"
If you try to see the file using Windows explorer using say "\\10.208.9.176\C\MyFolder\MyDatabase.mdb" I get the usual WindowsXP dialog box that says enter username & password.

Passwordprompt.jpg


I have the remote machine enabled for everything as administrator and everyone and all passwords cancelled.

Only if I type 'administrator' in the user name of the dialog box can I view the database. From then on my VB6 app works fine -
UNTIL a problem on the remote station that requires reloading WindowsXP or reversion to a previous setting.

Then I have to re enter administrator again and everything is OK!

I have tried what I think is everything but it still does it. Unfortunately once I type in administrator I cant normally reproduce the condition.

I set all 'control userpasswords2' passwords to none and "user needs to log on" to no.

Surely I shouldn't need to use Windows explorer to get VB6 to perform a task? So is it perhaps possible to recreate and automate what Windows Explorer does in a VB6 API routine?

Any more ideas or am I stuck with another Windows oddity?
 
I got to to work in a very cludgy fashion by simple using Sendkeys to send the exact strokes needed to enter the username.

Code:
Shell "Explorer.exe", vbMinimizedFocus
SendKeys "+{Tab}+{Tab}\\" & RemoteIPAddress, True 'try to connect Explorer to remote folders
SendKeys "{Enter}", True
SendKeys "administrator", True
SendKeys "{Enter}", True

This does not however solve the underlying problem of using vb6 to initially communicate with a file in a new remote computer.

I realise most people would not have ever come across it because they require a password in which case this dialog box is used manually when you first test a network connection. From then on every program does not need it unless a password is required.

In my case I am using unattended computers in a remote data gathering situation so there is no one to enter a password when it all reconnects after a power outage.

Any more ideas?
 
to connect to a remote share, I use,

cmd.exe /c net use \\computername\sharename password /USER:domainname\username

why not run this via Shell or something?
 
All of the computers should be in the same domain, or same workgroup if need be.

Nobody should be using the administrator account for applications. Very bad practice.

If using peer to peer networking (workgroups) each user/pw should be configured on each machine as a local account. If you have Tom, Dick, and Harry accounts define them at each system.

This way connecting to remote shares never needs to supply credentials.


You should also access these shares by machine name and not IP address. The networking infrastructure goes to a lot of trouble so you don't need to hard-code IP addresses, I suggest you use it.
 
In my setup I have 50 dedicated PCs without keyboards or monitors that are merely gathering data and reporting it back to a central server.
My VB6 App sets the ip address of each workstation when it runs to what is in an .INI file so that if a PC has to be replaced, the only thing the tech has to do is to make sure the correct ini file is loaded before reinstalling it.

Therfore I can't use machine names or workgroups.

Using Administrator saves all the setting up of accounts stuff. There is no person, keyboard or monitor at the location to check it

This works fine for TCPIP connections but I sometimes need to upload a file to a workstation folder.

It is when the machine has been replaced or reformatted that I get the problem I described.

I'll try JustinEzequiel's suggestion next time I get the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top