• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 806
  • Last Modified:

VBA login script

I'm looking for a vba login script to authenticat a windows xp home to a windows server 2003.
I know that a batch file like bellow will do it. I just want to try a vba script.
---------------------------------
net use \\192.168.10.200\DataFile /user:myusername mypassword
---------------------------------

thank you
0
MnInShdw
Asked:
MnInShdw
  • 5
  • 4
  • 4
1 Solution
 
TasmantCommented:
You can try this:
Set oNet = CreateObject("WScript.Network")
oNet.MapNetworkDrive "H:", "\\192.168.10.200\DataFile", True, "MyUsername","MyPassword"

Open in new window

0
 
TasmantCommented:
you need to save this to a .vbs file
0
 
MnInShdwAuthor Commented:
I don't need to map any network drive.
Just authentication with the server. (if possible)

thank you
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TasmantCommented:
it depends on what you want to do with your code.
not all functions provide a way to authenticate, and most of the time you will use your current credentials (ie the current username and password you entered at logon screen).
based on your current credentials, a negotiation for authentication will be done transparently between your computer and the server (Kerberos or NTLM) in AD domains.
so if you need more help to supply alternate credentials in your script, you need to post some part of your code in order to know what is your need and be able to see if any part of your code can be improved with what you need.
for the moment we cannot help you more.

you should add VB Script zone if you want more experts to see this topic.
0
 
MnInShdwAuthor Commented:
Here's the situation;

I've been asked to add a windows xp home to a network.
This network contains a windows server 2003 as the server and a lot of windows XPs as clients.
Active Directory (Domain) is not set up. The server is used just as a simple file server.
Each time this windows xp home accesses a shared folder on the server, a login dialog box is poped up which asks for a username and a password.
Because windows xp home hasn't "Remember Password" checkbox, the users of this PC has to input the password and the username to be able to access the shared folder.

I use a batch file that runs from startup to authenticate this machine with the server. In this way the login dialog box won't pop up.
this is the batch file that I use:
---------------------------------
net use \\192.168.10.200\DataFile /user:myusername mypassword
---------------------------------

I was just looking for a vba script to do the same task.
Each time the windows xp home reboots, this vba script will be run and atuthenticate it with the server.


I hope I'm clear enough.

Many Thanks.

0
 
TasmantCommented:
but you already do the job with your batch, what would you like to change?
0
 
TasmantCommented:
what do you believe the vba will do much more than a batch ?
0
 
MnInShdwAuthor Commented:
1- I learn a little bit about vba
2- it's just a test
3- a batch file will bring up cmd for a second, but running a vba script won't bring up(show) any ugly black screen.

 
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
You can hide the "ugly black screen"
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
Oops ... forgot the example:

here is a VBS scriptexampl:

RunHiiden.vbs
CreateObject("Wscript.Shell").Run """" & WScript.Arguments(0) & """", 0, False

Open in new window

0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
IIRC,  set up the name user name and password on with the XP Home and the server. I think this will do automatic authentication.
0
 
MnInShdwAuthor Commented:
I have no idea what this IIRC is.
Any kind of information about it is much appreciated.

Million thanks for your help.

By the way, as you suggested I added another question in VB section to find out if VB is able to [b]only[/b] do the authentication or not.

you may want to reply there too.
http://www.experts-exchange.com/Programming/Languages/Q_26897561.html

Once again thanks for your time and help.
0
 
Boyd (HiTechCoach) Trimmell, Microsoft Access MVPCommented:
FYI: IIRC = If I Remember Correctly
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

  • 5
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now