Solved

VBA login script

Posted on 2011-03-18
13
798 Views
Last Modified: 2012-05-11
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
Comment
Question by:MnInShdw
  • 5
  • 4
  • 4
13 Comments
 
LVL 11

Expert Comment

by:Tasmant
ID: 35166766
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
 
LVL 11

Expert Comment

by:Tasmant
ID: 35166771
you need to save this to a .vbs file
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 35166913
I don't need to map any network drive.
Just authentication with the server. (if possible)

thank you
0
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 11

Expert Comment

by:Tasmant
ID: 35166955
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
 
LVL 1

Author Comment

by:MnInShdw
ID: 35167124
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
 
LVL 11

Expert Comment

by:Tasmant
ID: 35167155
but you already do the job with your batch, what would you like to change?
0
 
LVL 11

Expert Comment

by:Tasmant
ID: 35167159
what do you believe the vba will do much more than a batch ?
0
 
LVL 1

Author Comment

by:MnInShdw
ID: 35167194
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
 
LVL 21
ID: 35167973
You can hide the "ugly black screen"
0
 
LVL 21

Accepted Solution

by:
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP earned 500 total points
ID: 35167987
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
 
LVL 21
ID: 35168011
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
 
LVL 1

Author Closing Comment

by:MnInShdw
ID: 35169949
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
 
LVL 21
ID: 35169976
FYI: IIRC = If I Remember Correctly
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface Having the need * to contact many different companies with different infrastructures * do remote maintenance in their network required us to implement a more flexible routing solution. As RAS, PPTP, L2TP and VPN Client connections are no…
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question